How to add a “open git-bash here…” context menu to the windows explorer?

前端 未结 12 1726
谎友^
谎友^ 2020-11-29 16:15

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?

12条回答
  •  一向
    一向 (楼主)
    2020-11-29 16:47

    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 Files\Git\git-bash.exe
    
    [HKEY_CLASSES_ROOT\*\shell\Open Git Bash]
    @="Open Git Bash"
    "Icon"="C:\\Program Files\\Git\\git-bash.exe"
    
    [HKEY_CLASSES_ROOT\*\shell\Open Git Bash\command]
    @="\"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_ROOT\Directory\shell\bash]
    @="Open Git Bash"
    "Icon"="C:\\Program Files\\Git\\git-bash.exe"
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\bash\command]
    @="\"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_ROOT\Directory\Background\shell\bash]
    @="Open Git Bash"
    "Icon"="C:\\Program Files\\Git\\git-bash.exe"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
    @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""
    

    And here is your result :

提交回复
热议问题