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

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

每次我发射Cygwin。


当前回答

在cygwin终端运行如下命令:

回显"cd your_path" >> ~/.bashrc

在打开一个新的bash会话时运行.bashrc脚本。当您打开一个新的cygwin会话时,上面的代码改变了your_path目录。

其他回答

以管理员身份打开Cygwin终端

在powershell中(使用巧克力):

choco install cyg-get

在cygwin 将安装右键菜单

cyg-get install chere
chere -i

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

您可以通过在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"

可能是最简单的一个:

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。

我制作了一个.reg文件,在右键单击上下文菜单中放入“打开Cygwin Here”选项。 它取决于Cygwin“chere”包,如果在初始设置中没有安装它,可以使用apt-cyg安装它。

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:\\cygwin\\bin\\mintty.exe -e /bin/xhere /bin/bash.exe"

我已经创建了批处理文件,并将其放到Cygwin的/bin目录中。开发此脚本的目的是允许安装/卸载注册表项,以便在Cygwin中打开选定的文件夹和驱动器。详情请参见http://with-love-from-siberia.blogspot.com/2013/12/cygwin-here.html。

更新:此解决方案与早期建议相同,但Windows注册表的所有操作都隐藏在脚本中。

执行安装命令

cyghere.bat /install

执行卸载命令

cyghere.bat /uninstall