如何创建在特定文件夹中打开Cygwin的Cygwin快捷方式?这样就不用打字了

cd /cygdrive/c/Users/Tom/Desktop/

每次我发射Cygwin。


当前回答

我使用以下几行代码在Win7的当前目录中启动zsh。

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash]
@="Open Cygwin Here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash\command]
@="\"C:\\Programmieren\\cygwin64\\bin\\mintty.exe\" -i /Cygwin-Terminal.ico /bin/zsh --login -c 'cd \"%V\";zsh'"

请注意,我使用%V而不是%L或%1(因为两者都不适合我)

其他回答

以管理员身份打开Cygwin终端

在powershell中(使用巧克力):

choco install cyg-get

在cygwin 将安装右键菜单

cyg-get install chere
chere -i

现在您可以在任何文件夹中单击右键并使用“Bash Prompt Here”。

如果您希望将该目录作为默认目录,只需在~/中添加一个cd语句。概要文件。

我倾向于使用该方法来设置我的常用目录,并为我的常见情况定义别名:

alias tom="cd /users/tom"

或者类似的东西。这让我可以非常快速地更改目录。

可能是最简单的一个:

1)创建文件foo.reg

2)插入内容:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\background\shell\open_mintty]
@="open mintty"

[HKEY_CLASSES_ROOT\Directory\background\shell\open_mintty\command]
@="cmd /C mintty"

3)执行foo.reg

现在只需右键单击任何文件夹,单击打开mintty,它将在该文件夹中生成mintty。

我不知道为什么我要浪费这么多时间,但这适用于我的win10, 64位:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash]
@="Open Cygwin Here"

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash\command]
@="C:\\cygwin64\\bin\\mintty.exe -i /Cygwin-Terminal.ico C:\\cygwin64\\bin\\bash.exe --login -c \"cd \\\"%V\\\" ; exec bash -rcfile ~/.bashrc\""

这是唯一的Cygwin64注册表解决方案,为我工作在Windows 8.1:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\mintty]
@="Mintty from Here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\mintty\command]
@="C:\\cygwin64\\bin\\mintty.exe -h always -e /usr/bin/ash -c 'cd  \"$(/usr/bin/cygpath \"%L\")\";  exec /usr/bin/bash  '"

请确保根据需要修改'C:\cygwin64'路径。