Windows: Copy file path to the clipboard

I often want to send the path of a file by email, either of local file or one on a network share. Sadly, Microsoft didn’t think of this use case, at least up to Windows XP, so I wrote this little VBS script that does exactly this (under Vista, just press SHIFT+Right click on the file, Copy as path).

If the path is within a drive that is mapped to a network resource, then the script will also replace the letter by the corresponding absolute location. The reason is that your colleagues may not use the same mapping as you do, making thereby a link to “X:…” useless.

Installation instructions :

  • Download this file
  • Save it as C:Documents and SettingsUSERNAMESendToCopyLocation.vbs (replacing USERNAME by your Windows login)

Usage :

  • Right click on a file, select Send To, CopyLocation.vbs :
    copylocation-usage
  • Wait a few seconds (especially the first time after a reboot)
  • Paste anywhere you want

Notes for the installation :

  • the SendTo directory is hidden by default in Windows, so enter the path either manually, or change your settings to show hidden files and dirs
  • It’s important to change the file name extension to .vbs

Troubleshooting :

  • If the path is not copied to the clipboard, open the file with the notepad, and replace CopyToClipboardIe by
    CopyToClipboardWord
    No idea which Internet Explorer setting prohibits to copy to the clipboard on some systems. Of course, the workaround requires MS Word installed

Keywords : windows explorer copy absolute path clipboard vbs script unc letter drive network

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s