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

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

每次我发射Cygwin。


当前回答

以管理员身份打开Cygwin终端

在powershell中(使用巧克力):

choco install cyg-get

在cygwin 将安装右键菜单

cyg-get install chere
chere -i

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

其他回答

这是唯一的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'路径。

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

我使用以下几行代码在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(因为两者都不适合我)

@echo off
C:
SET mypath=%~dp0
c:\cygwin\bin\bash -c "cd '%mypath%'; export CHERE_INVOKING=1; exec /bin/bash --login -i"

将上述命令复制到一个文本文件中,并将其保存为。bat在“您感兴趣的文件夹”中。 它应该在“您感兴趣的文件夹”中打开cygwin。

以管理员身份打开Cygwin终端

在powershell中(使用巧克力):

choco install cyg-get

在cygwin 将安装右键菜单

cyg-get install chere
chere -i

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