1、通過在“運行”中輸入‘regedit’,打開注冊表。
2、找到[HKEY_CLASSES_ROOT\Directory\Background]。
3、在[Background]下如果沒有[shell],則右鍵-新建項[shell]。
4、在[shell]下右鍵-新建項[open in git],其值為“Git Bash Here",此為右鍵菜單顯示名稱。(可以直接新建項Git Bash Here)
5、在[shell]下右鍵-新建-字符串值[Icon],雙擊編輯,其值為“D:\Tools\VersonCtrs\Git\Git\mingw64\share\git\git-for-windows.ico”。此為菜單加圖標。
6、在[open in git]下右鍵-新建-項[command],其值為"D:\Tools\VersonCtrs\Git\Git\bin\bash.exe" --login -i。
7、reg文件導出,包括刪除和添加。
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\Git Hash Here] "Icon"="C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico" @="Git Hash Here" [HKEY_CLASSES_ROOT\Directory\Background\shell\Git Hash Here\command] @="\"C:\\Program Files\\Git\\bin\\bash.exe\" --login -i"
刪除
Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Directory\Background\shell\Git Hash Here]
參考:
https://www.zhihu.com/question/48091139/answer/109144599
http://www.bubuko.com/infodetail-1263581.html
http://www.cnblogs.com/JoshuaDreaming/archive/2011/12/01/2270254.html