scoop installed git bash: "Open Git Bash" here context menu

4k Views Asked by At

I have installed git via Scoop on Windows 10 x64.

Using the detailed instruction from this answer I created my own reg script, to add a "Open Git Bash" command in the context menu of Windows Explorer, for my own user:

Windows Registry Editor Version 5.00

[HKEY_USERS\user-sid\Software\Classes\*\shell\Open Git Bash]
@="Open Git Bash"
"Icon"="C:\\Users\\fritzmg\\scoop\\shims\\git-bash.exe"

[HKEY_USERS\user-sid\Software\Classes\*\shell\Open Git Bash\command]
@="\"C:\\Users\\fritzmg\\scoop\\shims\\git-bash.exe\" \"--cd=%1\""

; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear

[HKEY_USERS\user-sid\Software\Classes\Directory\shell\bash]
@="Open Git Bash"
"Icon"="C:\\Users\\fritzmg\\scoop\\shims\\git-bash.exe"


[HKEY_USERS\user-sid\Software\Classes\Directory\shell\bash\command]
@="\"C:\\Users\\fritzmg\\scoop\\shims\\git-bash.exe\" \"--cd=%1\""

; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear

[HKEY_USERS\user-sid\Software\Classes\Directory\Background\shell\bash]
@="Open Git Bash"
"Icon"="C:\\Users\\fritzmg\\scoop\\shims\\git-bash.exe"

[HKEY_USERS\user-sid\Software\Classes\Directory\Background\shell\bash\command]
@="\"C:\\Users\\fritzmg\\scoop\\shims\\git-bash.exe\" \"--cd=%v.\""

However, there are two problems with this:

1. Icon does not work

The icon within the context menu does not work:

explorer context menu

May be this is more of a scoop issue. I am not sure how scoop creates those shims.

2. Two git bash windows open

When I actually use the context menu option, two git bash windows open:

opened git bash examples

One with the actual git bash, and one that just says "git-bash.exe". Closing either window closes both windows.

Of course I'd like to have it as if I had downloaded and installed git directly from https://git-scm.com/download/win . May be someone has any insights on how to alleviate those issues?

1

There are 1 best solutions below

1
On BEST ANSWER

The shim.exe doesn't have an icon, so it can't be displayed. In this case, it's recommended to use the current version path. (e.g. ~\scoop\apps\git\current\git-bash.exe)

Change the icon path to:

[HKEY_USERS\user-sid\Software\Classes\Directory\Background\shell\bash]
@="Open Git Bash"
"Icon"="C:\\Users\\fritzmg\\scoop\\apps\\git\\current\\git-bash.exe"