如何创建在特定文件夹中打开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”。

其他回答

我使用和图标启动我的cygwin没有chere包。

在我的桌面上为cygwin终端创建一个快捷方式。 右击图标并选择属性。 在快捷选项卡上,对TARGET使用这个: C:\cygwin64\bin\mint .exe -i /Cygwin-Terminal.ico -c 'cd' 对于START IN,将目录/文件夹的路径放在您想要的位置 启动cygwin。例如C: \一些\ dir \名字\

找到Cygwin.bat文件并制作如下内容:

@echo off
set newpath=%cd:\=/%
pushd "%~dp0"
chdir bin
bash --login -i -c "cd \"%newpath%\"; exec bash"

将cygwin.bat的路径添加到环境path中。

现在在任何文件夹中,你都可以输入地址栏:

cygwin

你也可以在cmd.exe中输入

正如two7s_clash所说,你首先需要安装chere包和安装mintty:

以管理员身份打开Cygwin终端 Apt-cyg安装chere 这里有薄荷

现在你可以在Windows资源管理器(上下文菜单)中用鼠标右键在特定目录中打开cygwin,并选择“Bash Prompt Here”。

您也可以使用windows命令提示符从指定目录打开cygwin:

打开windows命令提示符 导航(cd)到自定义目录 执行C:\cygwin64\bin\ minty .exe C:\cygwin64\bin\env.exe chere_invoke =1 C:\cygwin64\bin\bash.exe 该命令将打开cygwin,并从命令提示符获取当前目录。

FreeCommander

此命令还可以用于从自定义文件管理器(如freecommand)打开cygwin。

要打开从freecommand获取的当前目录的cygwin,请执行以下操作:

工具->收藏工具->收藏工具编辑…(Ctrl + Shift + Y) 添加一个新的工具栏(+图标),快捷方式:插入 名称:cygwin 程序或文件夹:C:\cygwin64\bin\mint .exe 开始文件夹:%ActivDir% 参数:C:\cygwin64\bin\env.exe chere_invoke =1 C:\cygwin64\bin\bash.exe -l

你可以添加自定义快捷方式从freecommand打开cygwin:

工具->定义键盘快捷键 向下滚动到“最喜欢的工具01”(或“最喜欢的工具N”) 指定新的快捷键:我使用Ctrl + Shift + T

伟大的参考:MinTTY维基,文章提示:开始在一个特定的目录

我已经做了一个注册表编辑脚本打开Cygwin在任何文件夹你右键单击。在我的GitHub上。

这是我的GitHub

来自Github的64位机器RegEdit示例代码:

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\CygwinHere]
@="&Cygwin Bash Here"

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

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\CygwinHere]
@="&Cygwin Bash Here"

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

要创建一个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上。