Skip to content

Instantly share code, notes, and snippets.

@nibocn
Last active May 8, 2023 03:39
Show Gist options
  • Save nibocn/5c4cc06558e8c84aa785 to your computer and use it in GitHub Desktop.
Save nibocn/5c4cc06558e8c84aa785 to your computer and use it in GitHub Desktop.
Windows中添加Cygwin的右键菜单

在注册表中创建信息

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Open Cygwin]
"Icon"="D:\\Software\\cygwin64\\Cygwin.ico"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Open Cygwin\Command]
@="D:\\Software\\cygwin64\\bin\\mintty.exe -i /Cygwin-Terminal.ico /bin/env _T=\"%V\" /bin/zsh -l"

修改~/.bash_profile配置

加入如下代码:

_T=${_T//\\//} #将所有的'\'替换为'/'
if [[ $_T == "" ]]; then
    _T=${HOME}
fi
cd "${_T}"
@amorphobia
Copy link

不错,好用,谢了!

@kgat96
Copy link

kgat96 commented Jan 23, 2018

D:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/env _T="%V" /bin/bash -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment