为Windows10 Bash添加右键菜单“Bash Here”

最近更新了Windows10一周年版,那么Bash肯定要拿来试试了。经过体验后,可以明确这个东东就是一个Ubuntu,自带的默认sh是dash。那么如果我们想随时随地使用他,就像git-bash右键菜单那样简单,应该怎么做呢?
新建一个文本文件,文件名改成*.reg,用文本编辑器编辑它,添加如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Bash]
@="Bash Here"

[HKEY_CLASSES_ROOT\Directory\shell\Bash\command]
@="cmd /s /k \"pushd %v && bash\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\Bash]
@="Bash Here"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Bash\command]
@="cmd /s /k \"pushd %v && bash\""

保存后双击导入即可,现在我们可以在任意文件夹空白地区和文件夹右键看到我们的右键菜单“Bash Here”了。