I’ve added a Windows right-click menu item by adding registry keys to HKCR\*\shell, where the command is of the form "path\to\my\program.exe" "params before" "%1" "params after". It seems that, if the user right-clicks on a shortcut (.lnk file), Windows is resolving the shortcut and passing the target file’s path in as %1. Does anyone know where this is documented? This is used on Windows 7 and Windows XP machines.
Thanks!
I don’t know if it is documented anywhere but it makes sense if you think about it. 99% of the time you want to see the context menu for the target, for a batch file for example it will show the (default) open verb and the edit verb. If the shortcut implementation did not do this then the context menu would be pretty useless since it would only contain commands related to the .lnk file (Cut, Copy, Delete and Properties)
If you also register a verb under
HKEY_CLASSES_ROOT\lnkfile\Shell, that verb should have the path to the .lnk when executed.