Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Open git bash here" and "Open command prompt here" disappeared from Windows explorer context menu

Short of re-installing git or editing the relevant registry key that adds context menus to the shell myself, I was wondering if there was another way to bring back the "Git Bash Here" and "Open command window here" menus?

I am using Windows 7 Home Premium 64-bit.

like image 202
Water Cooler v2 Avatar asked Sep 06 '25 03:09

Water Cooler v2


1 Answers

Checkout this SO question:

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

Update:

So I did a little more research into where the actual git bash and git gui context menu items were stored in the registry. I exported the keys that I had in my registry into a .reg file:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\""
like image 105
wheeler Avatar answered Sep 07 '25 21:09

wheeler