M HYPE SPLASH
// news

How to make 'copy as path' appear in Windows Explorer context menu without shift key?

By Emily Wilson

If I hold shift when opening the Windows Explorer context menu, an extra item appears, 'copy as path'. How can I make it so it always appears without having to hold shift?

I'm using Windows 10.

4

5 Answers

This script works (tested on Windows 10) without invoking command prompt:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Allfilesystemobjects\shell\windows.copyaspath]
@="Copy &as path"
"Icon"="imageres.dll,-5302"
"InvokeCommandOnSelection"=dword:00000001
"VerbHandler"="{f3d06e7c-1e45-4a26-847e-f9fcdee59be0}"
"VerbName"="copyaspath"

It also assigns a as the hotkey on the context menu, so RightClick+a copies the file path.

Bonus: Script to remove the above setting:

Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Allfilesystemobjects\shell\windows.copyaspath]

Script Credits

Screenshot from Windows 10 Enterprise v1809 build 17763.437:Copy as Path

4

AskVG here has a perfect solution. Though it says Windows 7, I've tried it on my Windows 10 PC and it works.

You can download the registry script straightaway from here. I've tested it and it contains no malicious code.


To prevent link rot, here are the contents of the REG file. Save the following as copyaspath.reg and then double-click to run.

Windows Registry Editor Version 5.00
;Created by Vishal Gupta for AskVG.com
[HKEY_CLASSES_ROOT\*\shell\Copy as Path]
[HKEY_CLASSES_ROOT\*\shell\Copy as Path\command]
@="cmd.exe /c echo | set /p=\"\"%1\"\"|clip"
[HKEY_CLASSES_ROOT\Directory\shell\Copy as Path]
[HKEY_CLASSES_ROOT\Directory\shell\Copy as Path\command]
@="cmd.exe /c echo | set /p=\"\"%1\"\"|clip"

Kudos to @chunk_split for a workaround to remove the newline.

4

I am unable to comment on user Private's response but this looks correct. Here are the registry entries needed from the file he linked.

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"
[HKEY_CLASSES_ROOT\Directory\shell\Copy as Path]
[HKEY_CLASSES_ROOT\Directory\shell\Copy as Path\command]
@="cmd.exe /c echo \"%1\"|clip"

You can just save that as a .reg and run it.

6

Here is the REG file:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Allfilesystemobjects\shell\CopyPath]
@="Copy Path"
[HKEY_CLASSES_ROOT\Allfilesystemobjects\shell\CopyPath\command]
@=hex(2):25,00,63,00,6f,00,6d,00,73,00,70,00,65,00,63,00,25,00,20,00,2f,00,63,\ 00,20,00,3c,00,6e,00,75,00,6c,00,20,00,28,00,73,00,65,00,74,00,2f,00,70,00,\ 20,00,61,00,6e,00,79,00,76,00,61,00,72,00,69,00,61,00,62,00,6c,00,65,00,3d,\ 00,22,00,25,00,31,00,22,00,29,00,7c,00,63,00,6c,00,69,00,70,00,2e,00,65,00,\ 78,00,65,00,00,00

(via Winhelponline) I removed the "Extended" string value.

The hex code in the above REG file translates to this command-line:

%comspec% /c <nul (set/p anyvariable="%1")|clip.exe

Well, SNag's answer is most elegant.

Don't Root's answer works, but you may see a balck CMD window flash quickly sometimes, and it does not support non-English characters. Here's an improved version from 1ocalhost.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Copy Path\command]
@="mshta vbscript:CreateObject(\"wscript.shell\").Run(\"cmd /c chcp 65001 && echo | set /p x=\"\"%1\"\" | clip\",0)(window.close)"

Because there's no clip.exe in Windows XP by default, 1ocalhost also provide another version for Windows XP:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Copy Path\command]
@="mshta vbscript:Execute(\"set o=CreateObject(\"\"InternetExplorer.Application\"\")\"&vbcrlf&\"o.Navigate(\"\"about:blank\"\")\"&vbcrlf&\"o.document.parentwindow.clipboardData.setData \"\"text\"\", \"\"%1\"\"\"&vbcrlf&\"o.Quit\"&vbcrlf&\"window.close\")"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy