How add context menu item to Windows Explorer for folders [closed]

In the registration editor (regedit.exe) find:

  • Context menu for right click on folders in left panel of Windows Explorer or on background of a directory in right panel:
  1. HKEY_CLASSES_ROOT\Directory\Background\shell if you are administrator
  2. HKEY_CURRENT_USER\Software\Classes\directory\Background\shell if you are a normal user
  • Context menu for right click on folders in right panel of Windows Explorer:
  1. HKEY_CLASSES_ROOT\Directory\shell if you are administrator
  2. HKEY_CURRENT_USER\Software\Classes\directory\shell if you are a normal user
  • Context menu for any file:
  1. HKEY_CLASSES_ROOT\*\shell if you are administrator
  2. HKEY_CURRENT_USER\Software\Classes\*\shell if you are a normal user

In all cases:

  1. add a new key under shell, naming it as you want to name the context menu item
  2. add a new key inside this key, named command (mandatory name)
  3. 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

Found a cleaner, easier and faster solution: create a text file, fill it with these contents, update it to your needs, save with .reg suffix and launch it (it does not need administrator priviliges because it accesses user-part of the registry):

Windows Registry Editor Version 5.00

; Setup context menu item for click on right panel:
[HKEY_CURRENT_USER\Software\Classes\directory\Background\shell\MenuItemNameBackground\command]
@="C:\\yourpath\\executable.exe \"%1\""

; Optional: specify an icon for the item:   
; HKEY_CURRENT_USER\Software\Classes\directory\Background\shell\MenuItemNameBackground]
;"icon"="C:\\yourpath\\appicon.ico"

; Optional: specify a position in the menu
; HKEY_CURRENT_USER\Software\Classes\directory\Background\shell\MenuItemNameBackground]
;"position"="Bottom"

; -------------------------------------------------------------------------------------

; Setup context menu item for click on folders tree item:
[HKEY_CURRENT_USER\Software\Classes\directory\shell\MenuItemNamePanel\command]
@="C:\\yourpath\\executable.exe \"%1\""

; Optional: specify an icon for the item:   
; [HKEY_CURRENT_USER\Software\Classes\directory\shell\MenuItemNamePanel]
;"icon"="C:\\yourpath\\appicon.ico"

; Optional: specify a position in the menu
; [HKEY_CURRENT_USER\Software\Classes\directory\shell\MenuItemNamePanel]
;"position"="Top"

In this way you can also have a backup of your configuration: just save the .reg file in a safe place. If you manually edit the registry after launching the file, right-click and slect "export".

Beware of double backspaces in path: \\