1、打开注册表编辑器
打开系统注册表,使用组合键"Win + R "输入"regedit"。
依次展开"HKEY_CLASSES_ROOT\Directory\Background\shell"。
![](https://img-blog.csdnimg.cn/direct/73aee23e4cf34c2e8a38baf089817b81.png)
2、新建右键菜单项
在[Background ]下找到"shell "如果没有则新建项shell,接着在"shell "下右键-新建项名字为"open in Git "并且修改默认值为"Git Bash Here"这个就是右键菜单显示的名字。
接着在"open in Git "下新建"字符串值 ",名字为"Icon"值为git安装目录下mingw64\share\git\的ico图标。
这一步其实就是设置右键菜单显示的小图标。
![](https://img-blog.csdnimg.cn/direct/7054f1cd122b429dbc8364e01491de4b.png)
![](https://img-blog.csdnimg.cn/direct/4241a439bcc0479782746aa8bd57454e.png)
3、建立command项
接着在"open in Git "新建项"command ",并且默认值数值数据里修改git安装目录的"git-bash.exe"路径。
![](https://img-blog.csdnimg.cn/direct/1e82714898f04254b075db20beeb31c2.png)
![](https://img-blog.csdnimg.cn/direct/a669da737a4b45c2aba5d6e27aac6db5.png)
保存后,就可以看到右键菜单了。
![](https://img-blog.csdnimg.cn/direct/d906a23b3007493bb9f52bd1ce7f1b84.png)
添加cmd、Powershell菜单与此类似,详细参考:鼠标右键添加自定义Cmd与Powershell【最全 最详细 含图标Icon】_鼠标右键powershell-CSDN博客