Problem

While using Git for Windows, aka Git, on a Windows machine you right-click in a folder or the desktop and select either Git GUI Here or Git Bash Here, and the following error results

1-git-gui-here-git-bash-here-windows-context-menu2-error-application-not-found

explorer.exe Application not found

 Cause

If the error is thrown selecting Git GUI Here then it’s caused by a bad filepath to git-gui.exe. If the is is thrown after selecting Git Bash Here then it’s caused by a bad filepath to git-bash.exe. While it’s rare to have a corrupted filepath in a context menu item, it can happen in the following cases:

  1. Git was uninstalled and its context menu items weren’t
  2. The Git program folder folder was moved
  3. The computer was restored to a previous state that didn’t have Git, which causes Git to be removed but not its registry values – this was my situation after reverting from Windows 10 to Windows 8.1

Solution: Fix Filepaths

Fixing the filepath isn’t hard, but it requires several modifications to the registry. So, before implementing the following solution, ensure that you’re comfortable making registry edits as they can damage the operating system.

  1. Create a Restore Point by following instructions at Creating a restore point in Windows 10
  2. Open ShellMenuView and locate the Menu Keys for Git Ba&sh Here and Git &GUI Here
    1. Download ShellMenuView for 32-bit Windows (ShellMenuView (x86)) or 64-bit Windows: ShellMenuView (x64)
    2. Extract ShellMenuView.zip to a new folder -> Copy shmnview.exe from the ShellMenuView to the Desktop
    3. Right-click shmnview.exe -> Select Run As Administrator
    4. Under the Menu Name Column, locate Git Ba&sh Here -> Note the Menu Key column value – it should be git_shell. This value is used later
      3-git-&gui-here-git-ba&sh-here-shellmenuview
    5. Under the Menu Name Column, locate Git &GUI Here -> Note the Menu Key column value; it should be git_gui. This value is used later.
      3-git-&gui-here-git-ba&sh-here-shellmenuview
  3. Open RegScanner as Administrator
    1. Download RegScanner
    2. Double-click to install
    3. Right-click RegScanner.exe -> Select Run as Administrator
  4. Backup all registry keys that contain git_gui
    1. Create a new search query in RegScanner by selecting File -> New Scan
    2. Apply the following settings in the Registry Scan Options window:
      4-registry-scan-options-git_gui

      1. Find String: git_gui
      2. Matching: Registry contains the specified string
      3. Look At: keys
      4. Don’t load more than: 10000 items
      5. Select all major keys
      6. Show found items during the scan process: yes
    3. Select Scan
    4. After the scan completes -> Select all registry keys -> Select Export Selected Items from the menu -> Save

  5. Update the filepath for all registry keys that contain git_gui
    Do the following for the HKCR\Directory\Background\shell\git_gui\command and HKCR\Directory\shell\git_gui\command registry keys

    1. Right-click on the registry key -> Select Open in RegEdit
    2. Right-click the registry key in RegEdit -> Select Modify
    3. Change the filepath so that it matches your Git installation. The defaults for all keys are shown below:
      16-default-filepath-git_gui
  6. Backup all registry keys that contain git_shell
    1. Create a new search query in RegScanner by selecting File -> New Scan
    2. Apply the following settings in the Registry Scan Options window:
      5-registry-scan-options-git_shell

      1. Find String: git_shell
      2. Matching: Registry contains the specified string
      3. Look At: keys
      4. Don’t load more than: 10000 items
      5. Select all major keys
      6. Show found items during the scan process: yes
    3. Select Scan
    4. After the scan completes -> Select all registry keys -> Select Export Selected Items from the menu -> Save
  7. Update the filepath for all registry keys that contain git_shell
    Do the following for  HKCR\Directory\Background\shell\git_shell\command and HKCR\Directory\shell\git_shell\command registry keys

    1. Right-click on the registry key -> Select Open in RegEdit
    2. Right-click the registry key in RegEdit -> Select Modify
    3. Change the filepath so that it matches your Git installation. The defaults for all keys are shown below:
      15-default-filepaths-git_shell
  8. Restart the computer