Registry Tweak to Add “Copy as Path” Option in Files and Folders Context Menu in Windows

Windows Vista, Windows 7 and Windows 8 comes with many new and advanced context menu options which were not available in Windows XP, “Copy as Path” option is one of them.

Copy as Path” option appears whenever you press “Shift” key and right-click on a file or folder. This option automatically copies the full path of the selected file or folder to clipboard. It might come very useful in many situations.

We have shared a few freeware to get this option in Windows XP which can be downloaded using following link:

Advertisement

How to Get Windows Vista and 7’s “Copy as Path” Option in Windows XP Context Menu?

In the above mentioned topic, one AskVG reader “Stamimail” asked for a Registry tweak to add the same option without using any 3rd party software. I tried the code given by another reader “Allal” in the same topic but it didn’t work. After a little tweaking, I got success in adding the “Copy as Path” option in files and folders context menu with the help of Registry Editor.

Copy_As_Path_Option_Context_Menu_Windows.png

So if you also want to enjoy “Copy as Path” option, check out following simple steps:

1. Type regedit in RUN dialog box and press Enter. It’ll open Registry Editor.

2. Now go to following key:

HKEY_CLASSES_ROOT\*\shell

Advertisement

3. Under shell key, create a new key and set its name to Copy as Path.

4. Now create another new key under the new Copy as Path key and set its name to command.

So the final path would be:

HKEY_CLASSES_ROOT\*\shell\Copy as Path\command

5. Now click on command key and in right-side pane, set the value of (Default) to:

cmd.exe /c echo “%1″|clip

Add_Copy_As_Path_Option_Context_Menu_Windows.png

That’s it. It’ll immediately add the “Copy as Path” option in files context menu. Just right-click on a file and select “Copy as Path” option and it’ll copy the full path to clipboard. You can paste it in a text editor, browser or anywhere else.

NOTE 1: The above mentioned code copies the path within double-quotes (“”). If you don’t want the double-quotes, use following code instead:

cmd.exe /c echo %1|clip

NOTE 2: The above mentioned code puts Carriage Return or Line Feed (CR/LF) after the copied path. If you just want to copy path without line feed, use following code instead: (Thanks to Geoff for sharing this code…)

cmd.exe /c (echo.|set /p=””%1″”) | clip

6. If you also want to add “Copy as Path” option in folders context menu, follow the same steps 3-5 for following key as well:

HKEY_CLASSES_ROOT\Directory\shell

PS: If you don’t want to modify Registry yourself and want a ready-made Registry script to do the task automatically, download following ZIP file, extract it and run the extracted REG file. It’ll ask for confirmation, accept it:

Download Registry Script to Add “Copy as Path” Option in Windows

Published in: Windows 7, Windows Vista, Windows XP

About the author: Vishal Gupta (also known as VG) has been awarded with Microsoft MVP (Most Valuable Professional) award. He holds Masters degree in Computer Applications (MCA). He has written several tech articles for popular newspapers and magazines and has also appeared in tech shows on various TV channels.

Comments

NOTE: Older comments have been removed to reduce database overhead.

  1. Great work once again Vishal, although I know there are elements of your site I’ve not agreed with in the past, you do put up some very handy stuff.
    Can you give a working example as to how this would be used? I don’t quite follow the concept of copying something as a path to the clipboard *shrugs*

  2. ^^ For example you are working in Command Prompt and you want to make certain folder active. You can copy its path from Windows Explorer and paste the string in Command Prompt.

    There are many situations when this trick might come handy. You might need to send the path of a file or folder to someone via email for troubleshooting purposes.

  3. Sorry but the registry script did NOT work for me on my XP HE SP3 machine (italian language), it added the “Copy as Path” option in files and folders context menu but right-clicking on a file or folder copies NOTHING to clipboard… 🙁

  4. Same as Gianni but I’ve got XP Pro SP3 32 bit US English. First I tried editing my registry myself but leaving the quotation marks out since I don’t want them. Then I downloaded the zip file containing the two REG files. Ran the “Remove . . .” REG file first to get rid of my own attempt, than ran the “Add . . ” REG file to try to get it to work with quotes.

    Nothing happens. My clipboard is NOT modified and the paths do NOT appear on my clipboard. There is a window which appears briefly and then vanishes again. I assume it’s the CMD window specified in the command value in each REG file.

    I exported my two registry keys so you could see them. Here they are:

    —————————————————————————————–
    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\Shell\Copy as Path]

    [HKEY_CLASSES_ROOT\*\Shell\Copy as Path\command]
    @=”cmd.exe /c echo \”%1\”|clip”
    —————————————————————————————–
    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Directory\Shell\Copy as Path]

    [HKEY_CLASSES_ROOT\Directory\Shell\Copy as Path\command]
    @=”cmd.exe /c echo \”%1\”|clip”
    —————————————————————————————–

    These registry entries are what happens to my registry after I unzip and click on the two REG files. Why do they work for others but not for me?

  5. Hey Gianni and everybody else for whom this doesn’t work. You’re probably missing the file CLIP.EXE which should be in your WINDOWS folder. You can get CLIP.EXE from Microsoft at this FTP link: f t p.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/FILE/CLIP.EXE

  6. Hi Don Nadie, you’re absolutely right, I’ve downloaded and pasted Clip.exe into the Windows\System32 directory and now the VG tweak works like a charm…thank you very much for your help!

  7. Glad to be of help Gianni and anyone else who was missing the CLIP.EXE file.

    I didn’t like the quick appearance and disappearance of the CMD window every time I used the registry tweak from VG.

  8. Yes before putting in regedit, I was trying it out in cmd window and was being told “clip” isn’t a program. Thanks to “Don Nadie” for the apt reply with URL. This is my

    HKEY_CLASSES_ROOT\*\shell\Copy Path\command :
    cmd.exe /c echo %1 | clip

    And another useful one :
    HKEY_CLASSES_ROOT\*\shell\Open Folder\command :
    explorer.exe /select,”%1″

    Thanx for Vishal & all the others who’re trying to help out.

  9. Top tip VG

    If you dont want the newline to go onto the clipboard then use

    cmd.exe /c (echo.|set /p=””%1″”) | clip

    Thanks to Aaron & Earl on devtrends.com for “echo without CR LF”

  10. You are a lifesaver. My initial need was to copy the regedit path. I created the key as you instruct and now when I r-click on a registry key and click Copy Key Name I get the entire path. Before I would just get the key’s name. Thanks so much, I would bake you a cake if I knew where to send it. I’ll settle for sending a virtual “thank you hug.”

  11. cmd.exe /c echo “%1″|clip —-will copy path to clipboard …….if we want to copy it to .txt
    file then what is the code…………..thanks

  12. I love this! I don’t know why copy as path was designed as a two hand operation to begin with. I could see something like “format” being a hidden command, but copy as path is not potentially hazardous. Doesn’t make sense. It seems to not work on executable files though. When I right click a *.exe or *.msi file and select the newly revealed Copy as Path option, it runs the file and does not copy the path to the clipboard. If I use the shift+right click-copy as path method, it performs the operation correctly. (Win7ProSP1) Thanks again for posting this, I appreciate it.

  13. Good Reg Hack, very greatful, you forgot to make a an entry for copy the path of current folder when background is highlighted though:
    ===================================
    [HKEY_CLASSES_ROOT\Directory\Background\shell\Copy as Path]

    [HKEY_CLASSES_ROOT\Directory\Background\shell\Copy as Path\command]
    @=”cmd.exe /c echo \”%V\”|clip”
    ======================================
    Uninstall
    ======================

    [-HKEY_CLASSES_ROOT\Directory\Background\shell\Copy as Path]

  14. Draw backs
    1 : it works for 1 file at a time , not multiple files at a time,
    2 : It launches cmd to clip the file path

    any solutions ??

  15. hi, VG.
    How can I add “Copy name” to Right Click menu for files and folders (without any software)?

    Thanks.

  16. ^^ It’ll be hard to achieve. I’ll try to find the code to copy file/folder names. If I come across any solution, I’ll let you know.

  17. @Sunny

    Were you able to find the answer to your question? I am also looking for this.

Leave a Comment

Your email address will not be published. Required fields are marked *

NOTE: Your comment may not appear immediately. It'll become visible once we approve it.