This post explains how to add the Copy as Path right-click menu option for files and folders in Windows XP. Windows Vista and Windows 7 already include 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. Let’s adds the functionality to Windows XP.
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.
Download copypath.reg and save it to the Desktop. Right-click on the file and choose Merge. Click Yes when asked for confirmation. This adds the following registry key:
and sets the (default) value to:
%comspec% /c <nul (set/p anyvariable=”%1”)|clip.exe
You’ll see the Copy as Path option when you right-click a file or folder.
Note: Previously it was %comspec% /c echo "%1"|clip.exe, but since that adds a line feed, I had to change the above code. Thanks Eric.
Download copypath.zip extract and save the Script file copypath.vbs file in 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:
If you think of any other script ideas, feel free to post them in the Comments section below