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

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

每次我发射Cygwin。


当前回答

在我的Windows电脑上,它没有显示:

切尔 -i -t 薄荷

因为薄荷shell是不可用的,但你可以选择各种其他shell,如ash bash cmd dash mksh pdksh posh tcsh zsh passwd。

所以我用:

Chere -i -s bash

其他回答

您可以通过在Cygwin.ico文件的路径中添加icon字段来将图标添加到shell中。

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash]
@="Cygwin"
"Icon"="\"C:\\cygwin64\\Cygwin.ico\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cygwin_bash\command]
@="C:\\cygwin64\\bin\\mintty.exe -e /bin/xhere /bin/bash.exe"

要创建一个Windows快捷方式,在您自己选择的目录中启动Cygwin终端,请尝试以下操作:

Right-click on the Windows desktop, select 'New', and then select 'Shortcut'. For location of the item, enter the following text, changing the mintty path as needed and substituting the name of the desired directory where indicated. C:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd DESIRED-DIRECTORY; exec bash' For example, the OP would use the following text: C:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd /cygdrive/c/Users/Tom/Desktop/; exec bash' Click 'Next'. Enter the desired name for the shortcut and click 'Finish'.

可以在桌面上放置多个快捷方式,在各种经常访问的目录中打开Cygwin终端。

灵感来自解决方案张贴如何打开一个Cygwin shell在一个特定的目录从Netbeans?在superuser.com上。

我也有问题与git,它曾经“窃取”我的cygwin命令-所以我需要运行 C: \ cygwin \ bin \ mintty.exe - 但是在安装chere并以管理员身份执行chere -i -t mintty -f之后(见上文),你可以简单地使用: C:\cygwin\bin\ minty .exe -e /bin/xhere /bin/bash.exe 我在Total Commander中添加了这个自定义按钮(右键单击面板> add…),它工作得非常好。

在我的Windows电脑上,它没有显示:

切尔 -i -t 薄荷

因为薄荷shell是不可用的,但你可以选择各种其他shell,如ash bash cmd dash mksh pdksh posh tcsh zsh passwd。

所以我用:

Chere -i -s bash

这是我用的。它不需要修改包或注册表。适用于Windows 7。

进入“发送到”文件夹:

C:\Users\<your_user_name>\AppData\Roaming\Microsoft\Windows\SendTo

在目标字段中创建一个名为Bash Here的快捷方式:

C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico  C:\cygwin\bin\bash.exe  -l -c "cd \"$0\" ; exec bash"

在Windows资源管理器中,右键单击一个文件夹并选择发送到> Bash Here。

这里有一个相反的技巧,在当前bash目录下打开Windows资源管理器。创建这个别名:

alias winx='/cygdrive/c/Windows/explorer.exe /e,\`cygpath -w .\`'

注:cygpath为-w。以上部分用反引号括起来。

现在只要在bash提示符下输入winx,就会弹出一个Win资源管理器。

注意:如果winx引导您到文档文件夹,请尝试

alias winx='/cygdrive/c/Windows/explorer.exe /e,`cygpath -w $PWD`'