I have a tool that I added to the shell subkey of the any-file key under HKEY_CLASSES_ROOT so that it appears in the right click menu of any file (also have this in directory menu).
[HKEY_CLASSES_ROOT\*\shell\PathToClipboard]
@="Path -> Clipboard"
[HKEY_CLASSES_ROOT\*\shell\PathToClipboard\command]
@="C:\\Program Files (x86)\\PathToClipboard.exe %1"
The tool does nothing more than copying the given parameter (the filepath) to the clipboard.
This worked for ages at least since Win ME (may have recompiled since then). It also kind of works for win-7 but with some quirks: If the file path does contain spaces or any other non alphanumeric characters it is shortened to the DOS compatibility Name.
For example: C:\PROGRA~2\PATHTO~1.EXE
Is there a way around this?
If i put "
around the %1
the path is correct but windows also passes the "
to the program (that i have not touched quite a while. sure i could solve this in the tool, but i wonder if the crude behavior could be fixed on windows side).
"C:\Program Files (x86)\PathToClipboard.exe" "%1"
? note the extra"
s and removed backslashes."
solves the issue! the%1
soes not have to be between quotes marks, otherwise the copied path will be also have quotes. If you post this as an answer i will accept it - Thank you! your second suggestion feels some kind of brutal - I do not know if it breaks other stuff.