windows下右键添加菜单:“在此处打开 Cygwin”

新建文本,添加如下代码,并保存为.reg文件,双击导入即可.
注意:
1. 将E:\\tools\\cygwin替换为实际的目录.
2. 注意保存格式为: CR LF + ANSI

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cygwin Here]
@="在此处打开 Cygwin"
"Icon"="E:\\tools\\cygwin\\Cygwin.ico"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cygwin Here\command]
@="E:\\tools\\cygwin\\bin\\mintty.exe -i /Cygwin-Terminal.ico /bin/bash --login -c 'cd \"$(cygpath \"%V\")\"; exec bash'"
  • %V:Windows 注册表传入的“当前目录”路径(右键点击的背景目录)
  • cygpath:把 Windows 路径转换成 Cygwin 路径
  • exec bash:进入目标目录后再继续执行 bash,仍停留在交互终端

Related Posts