简体   繁体   中英

“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.

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.\""

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM