1st of March 2006
Windows' File Context Menus
I've spent ages today trying to find how to add my own context-menu entry into the Windows Explorer shell. It's shockingly simple, I don't know why the web sites out there have to over-complicate it so much. Here it is in simplified form:
Create a registry entry at
HKCR\*\shell\<unique name>
Where <unique name> is something meaningful to your app, eg "backup". Set the default value for this key to whatever text you want to appear in the right-click context menu for files. Eg. "&Back this file up" (the & defines which character will become the keyboard shortcut on the menu)
Inside of this key create another key named "Command", eg:
HKCR\*\shell\backup\Command
Set the default value of this key to the path to the program you wish to run. You can also use certain parameters such as %1 (the name of the selected file) or %L (the name of the folder the file resides in). Eg
c:\program files\backup\backup.exe "%1"
This works great for me except for one strange thing: When I select multiple files and click on my newly created context menu item it, for reasons unknown, spawns a freeware hex editor I installed the other day. What the...?! Anyone know what's going on there?
HTH