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

13

2

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.

Colonel Panic

Posted 2013-04-15T09:55:15.913

Reputation: 9 529

I'm surprised this didn't work; what version of Windows are you on? – Dave – 2013-04-15T10:26:43.470

2this works fine. The extended entry controls if the entry is not shown by default and must be opened with Shift. I use this to hide entries that I don't use very often. – magicandre1981 – 2013-04-19T04:17:34.293

The trick in the other question only works for the Open Command Prompt here item. Here's another potential, but not working, answer. http://superuser.com/questions/295484/unhide-windows-7-context-menu-extras-permanently

– O. Jones – 2013-07-18T23:23:41.677

Answers

10

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.

Don't Root here plz...

Posted 2013-04-15T09:55:15.913

Reputation: 1 772

Doesn't work for me. The command prompt just appeared and disappeared. Windows 7 32-bit. – Sun – 2016-04-05T15:23:39.607

@sunk818 Yeah, according to the comments, this doesn't work on Windows Xp or 7 but works on Windows 10. Don't know what the problem is but it works on my computer :) (Windows 10 ver1511). – Don't Root here plz... – 2016-04-05T16:31:52.887

Check my solution. It doesn't do the command prompt open-run-vanish trick.

– SNag – 2017-12-12T20:01:16.070

This works very well, except it introduces an extra newline at the end (due to how echo works). You can use the following workaround to avoid that. Note the extra escaped quotes, escaped 2x, first time using backslashes for Windows Registry file format to get "" needed for the set /p command resulting in finally a single " in your copied string, so the full line becomes:

@="cmd.exe /c echo | set /p=\"\"%1\"\"|clip" – chunk_split – 2019-05-03T20:23:52.440

8

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

SNag

Posted 2013-04-15T09:55:15.913

Reputation: 773

I can confirm that works on Win 10 Version 1709 64bit – Varun Sharma – 2018-04-14T22:34:25.797

This works still perfectly, no messy popups. – Lassi Kinnunen – 2019-07-09T14:08:45.050

On Windows 7: "This file does not have a program associated with it for performing this action..." – Hashim – 2019-10-01T21:30:48.300

1

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.

Narzard

Posted 2013-04-15T09:55:15.913

Reputation: 2 276

You are unable to comment on my response? You could have just edited mine. – Don't Root here plz... – 2016-04-05T16:33:16.927

I do not have enough reputation to add a comment unfortunately. – Narzard – 2016-04-05T17:19:28.613

or edit my post? – Don't Root here plz... – 2016-04-05T17:29:31.460

1I've edited Private's post. This post can safely be deleted. – Engineer Toast – 2016-04-06T21:14:27.163

1@EngineerToast: I wouldn't count it as safe unless there's some record of Narzard's involvement on that question ;) – SamB – 2016-10-05T20:08:25.380

@SamB I agree. That's why I commented in an effort to ping Narzard to come my action. They should be able to edit now, anyway. – Engineer Toast – 2016-10-05T20:48:45.083

0

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

w32sh

Posted 2013-04-15T09:55:15.913

Reputation: 8 611

0

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\")"

Pamela

Posted 2013-04-15T09:55:15.913

Reputation: 1