此处以添加Git Bash Here为例
一.操作步骤
-
按
Win + R键打开 运行 对话框,输入regedit,并按下回车,打开注册表编辑器。 -
导航到
HKEY_CLASSES_ROOT\Directory\Background\shell。 -
右键单击
shell,选择 新建 → 项,并命名为Git Bash Here。 -
右键新建的项
Git Bash Here,选择 新建 → 字符串值,命名为Icon,然后将其值设置为 Git 安装目录下的bash.exe文件的路径(例如:E:\Git\bin\bash.exe)。 -
在
Git Bash Here项下,右键单击并选择 新建 → 项,命名为command。 -
在
command项下,右键单击并选择 修改,然后将其值设置为 Git 安装目录下的bash.exe,并加上参数--login -i(例如:E:\Git\bin\bash.exe --login -i)。
二.注册表文件
也可以写成*.reg文件,直接双击添加到本机注册表,快捷方便
git_gui.reg
Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui]
@="Git &GUI Here"
"Icon"="E:\\Git\\cmd\\git-gui.exe"[HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui\command]
@="\"E:\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\""
git_shell.reg
Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="E:\\Git\\git-bash.exe"[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command]
@="\"E:\\Git\\git-bash.exe\" \"--cd=%v.\""