How add context menu item to Windows Explorer for folders
contextmenu, explorer, windows-shell-extension-menu
Solution
In the registry editor (`regedit.exe`) find:
Right click on BACKGROUND of right panel
- `HKEY_CLASSES_ROOT\Directory\Background\shell` if you are administrator
- `HKEY_CURRENT_USER\Software\Classes\directory\Background\shell` if you are a normal user
Right click on FOLDER ICON in left/right panel of Windows Explorer
- `HKEY_CLASSES_ROOT\Directory\shell` if you are administrator
- `HKEY_CURRENT_USER\Software\Classes\directory\shell` if you are a normal user
Right click on file
- `HKEY_CLASSES_ROOT\*\shell` if you are administrator
- `HKEY_CURRENT_USER\Software\Classes\*\shell` if you are a normal user
In all cases:
- add a new key under `shell`, naming it as you want to name the context menu item
- add a new key inside this key, named `command` (mandatory name)
- edit the `default` property in `command` to `myprogrampath\path\path\executable.exe "%1"` to pass the file path and name of the selected file to your custom program (for `.../Directory/Background` and `.../directory/Background` cases use `%V` instead of `%1`)
More customization:
- Add icon: add a string value named `icon` for key created at step 1 with value matching an icon resource path. You can also provide an integer arguments to specify which icon to use. Example: `%SystemRoot%\System32\shell32.dll,3`
- Display only on shift-click: add an empty string value named `Extended` for key created at step 1
- Customize menu entry label: change the value of default value for key created at step 1
- Change menu entry location: add a string value named `Position` with one of: `Top`, `Bottom`
Problem
I have found out how to add right-click context menu items to files on Windows Explorer, by adding keys to the registry. I.e. I can right-click on a file in Explorer and run a custom app against that file. I would like to do the same for a folder and have not found a way to do that (yet). I see articles on creating/writing custom context menu handlers, but I would rather not go there. I have found an article here on how to add cascading context menu items to the Desktop and to the "Computer" in Explorer, but this does not work for any folder. I would like to be able to add my custom app to the context menu and have it work on both files and folders. Is there a way to do this without writing a context menu handler? I found the solution in the below article, which describes how to do this via the registry for files, as well as for folders: - How to Add Any Application Shortcut to Windows Explorer’s Context Menu The following two articles provided additional info and options: - Ultimate Tutorial to Customize Desktop Context Menu in Windows Vista, 7 and 8 - Add Cascading Menus for Your Favorite Programs in Windows 7 Desktop and My Computer Context Menus