How do you add an item to the context menu of a folder?

I know how to add a context menu for when you click on an actual folder:

[HKEY_CLASSES_ROOT\Directory\shell\commandNameHere]

but what about clicking on nothing in a folder?

like I make a new folder on my desktop, double click to enter the folder, then right click on nothing (the folder is empty), now I want my context menu to appear in this situation.


Solution 1:

For anyone interested, here's the .reg file to add this functionality to the windows context menu:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Shell]
@="none"
[HKEY_CLASSES_ROOT\Directory\shell\gitBashHere]
[HKEY_CLASSES_ROOT\Directory\Background\shell\gitBashHere]
"Icon"="C:\\icons\\git-gui.ico"
"MUIVerb"="git bash here"
"Position"="bottom" 
[HKEY_CLASSES_ROOT\Directory\shell\gitBashHere\command] 
[HKEY_CLASSES_ROOT\Directory\Background\shell\gitBashHere\command]
@="C:\\Program Files\\Console2\\Console.exe -d %v"

(Taken from xero's comment)

This adds a command to the context menu named "git bash here" with an icon, which opens a console.

The command is added under both:

  • HKEY_CLASSES_ROOT\Directory\shell, the context menu when you right-click on a folder
  • HKEY_CLASSES_ROOT\Directory\background, the context menu when you right-click on the "background" empty space while in a folder