Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
841 views
in Technique[技术] by (71.8m points)

contextmenu - How to add a "open git-bash here..." context menu to the windows explorer?

How to add a context (aka right click) menu to the windows explorer that, when clicked, opens the git-bash console in the current explorer folder?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Step 1. On your desktop right click "New"->"Text Document" with name OpenGitBash.reg

Step 2. Right click the file and choose "Edit"

Step 3. Copy-paste the code below, save and close the file

Step 4. Execute the file by double clicking it

Note: You need administrator permission to write to the registry.

Windows Registry Editor Version 5.00
; Open files
; Default Git-Bash Location C:Program FilesGitgit-bash.exe

[HKEY_CLASSES_ROOT*shellOpen Git Bash]
@="Open Git Bash"
"Icon"="C:\Program Files\Git\git-bash.exe"

[HKEY_CLASSES_ROOT*shellOpen Git Bashcommand]
@=""C:\Program Files\Git\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_CLASSES_ROOTDirectoryshellash]
@="Open Git Bash"
"Icon"="C:\Program Files\Git\git-bash.exe"


[HKEY_CLASSES_ROOTDirectoryshellashcommand]
@=""C:\Program Files\Git\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_CLASSES_ROOTDirectoryBackgroundshellash]
@="Open Git Bash"
"Icon"="C:\Program Files\Git\git-bash.exe"

[HKEY_CLASSES_ROOTDirectoryBackgroundshellashcommand]
@=""C:\Program Files\Git\git-bash.exe" "--cd=%v.""

And here is your result :

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...