Windows Vista already includes the useful Copy as Path option in the context menu, which helps you quickly copy the complete path of the selected file or folder to the Clipboard. Earlier, we added the Add to Quick Launch and Open file location options to the context menu in Windows XP, as in Windows Vista. Here is how to add the Copy as Path functionality in Windows XP via the context menu.

There are two methods discussed, both of them require the Clip.exe file from Microsoft. Clip.exe redirects command-line output to the Windows Clipboard. For example, typing the command dir | clip in a Command Prompt window places a copy of the current directory listing into the Windows clipboard.

Note: When using the Copy as Path command after following the steps in Method 1, you’ll see a Command Prompt window opening and closing briefly. Method 2 uses a VBScript which launches the Command Prompt window in invisible mode.

Download Clip.exe from the Microsoft FTP site here and save the file to your Windows directory.

(To open the Windows directory in your system, click Start – Run, type %systemroot% and press ENTER.)

Then, follow one of the methods below.

METHOD 1

Download copypath.reg and save it to the Desktop. Right-click on the file and choose Merge. Click Yes when asked for confirmation.

METHOD 2

Download copypath.vbs and save it to your Windows directory.

Double-click copypath.vbs to run it.

Press ENTER when you see the following prompt:

To remove the Copy as Path context menu option, double-click the copypath.vbs file, type UNINSTALL and press ENTER. Then delete the file copypath.vbs manually from your Windows directory.

After following one of the methods above, Copy as Path option will be added to the context menu. To copy a file or folder path to Clipboard, press and hold the SHIFT key, right-click on the file or folder and click Copy as Path.

Additional Tip: If you want to make the Copy as Path command always available (without needing to use the SHIFT key), simply delete the value named Extended in the registry location below, using the Registry Editor:

HKEY_CLASSES_ROOT \ Allfilesystemobjects \ shell \ CopyPath

SEE ALSO

If you think of any other script ideas, feel free to post them in the Comments section below :)

Bookmark this Page!

BlinkList | del.icio.us | Digg it | Furl | reddit | Spurl | StumbleUpon |

Related Posts


Email SubscriptionPrefer an E-mail subscription?

Enter your email address:

Delivered by FeedBurner

10 Responses to “Add “Copy as Path” Option to the Context Menu in Windows XP” Subscribe to comments!

  1. said this on Thursday, June 18th 2009 2:19 pm

    Your really crazy because for using this functionality, you are on “Windows Explorer”, launch command in MS-DOS “CLIP.exe” for inject information in the “Windows Clipboard”

    I hope that Microsoft have a better solution for Windows 7.
    I’ll check this when have the time.

  2. Eric
    said this on Thursday, January 1st 2009 12:47 pm

    Sorry, George. Don’t know of a solution for you, short of you debugging the script on your machine. The script’s worked fine for me on a number of machines.

  3. George
    said this on Wednesday, December 31st 2008 10:14 pm

    Yes I get the same results.

  4. Eric
    said this on Wednesday, December 31st 2008 5:53 am

    George, not sure why it’s not working. At the command prompt, what do you get if you echo the following?
    echo %systemroot%
    echo %comspec%

    I get C:\WINDOWS for %systemroot% (which is where I installed the script) and C:\WINDOWS\system32\cmd.exe for %comspec%.

  5. George
    said this on Sunday, November 23rd 2008 6:15 am

    After trying Eric’s version, I discovered that both of them work, but only in the C:\WINDOWS folder. If I go to another folder, the paste repeats the last copy from the last C:\WINDOWS folder copy.

    Erics version does not have the quotes and line feed.

    Have I missed something?

  6. George
    said this on Sunday, November 23rd 2008 1:57 am

    I have Windows XP Home. I did Method 2.
    The “Copy as Path” option appears, but when I paste it somewhere, there is nothing.

  7. said this on Wednesday, September 17th 2008 11:30 pm

    Nice one! Thanks for the edit, Eric.

  8. Eric
    said this on Wednesday, September 17th 2008 9:47 pm

    Be careful with those quote marks in the above comment if copying and pasting – they should all be standard double quotes, but the blog converted them into left and right double quotes.

  9. Eric
    said this on Wednesday, September 17th 2008 9:45 pm

    Nevermind, figured it out myself.

    After a little digging, I found this page: http://www.winhelponline.com/blog/add-copy-as-path-option-to-the-context-menu-in-windows-xp/

    So, if using your Method 2, replace line 20 and 21, which were:
    WshShell.run “%comspec% /c ” & “echo ” & chr(34) & _
    WScript.Arguments.Item(0) & chr(34) & “| clip.exe”,0

    with:

    WshShell.run “%comspec% /c ” & “<nul (set/p anyvariable=” & chr(34) & _
    WScript.Arguments.Item(0) & chr(34) & “)| clip.exe”,0

    This gives you the bonus of no quote marks as well.

    Or, if using Method 1, use regedit to replace the value in HKEY_CLASSES_ROOT\AllFileSystemObjects\shell\CopyPath\command
    Originally, this is: %comspec% /c echo “%1″|clip.exe
    Change it to: %comspec% /c <nul (set/p anyvariable=”%1″)|clip.exe

  10. Eric
    said this on Wednesday, September 17th 2008 9:01 pm

    Any way to get this to copy the path without also copying a line break at the end of the path?

Leave a Reply