如何创建在特定文件夹中打开Cygwin的Cygwin快捷方式?这样就不用打字了
cd /cygdrive/c/Users/Tom/Desktop/
每次我发射Cygwin。
如何创建在特定文件夹中打开Cygwin的Cygwin快捷方式?这样就不用打字了
cd /cygdrive/c/Users/Tom/Desktop/
每次我发射Cygwin。
当前回答
当需要重新安装时,我创建了一个名为HOME的Windows“用户环境变量”,并将其分配给“我的文档”所在的路径。
cygwin安装程序检测HOME变量,自动将其转换为cygpath,并选择它作为我的~目录。
这在我过去5年专业使用的每个工作站(大约3或4,Win7)上都工作得很好。我一直是这些机器上唯一的用户,不能说效果是什么。
其他回答
我已经做了一个注册表编辑脚本打开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\""
当您安装Cygwin时(或者如果您已经安装了Cygwin,请再次下载并重新开始安装以运行更新),请确保您在“shell”类别下选择了chere包。
启动Cygwin后,打开Cygwin终端(以管理员身份)并键入命令:chere -i -t mintty -s bash。
现在在Windows右键上下文菜单中应该有“Bash Prompt Here”。
(mintty是Cygwin的默认终端。如果你不选择-t选项,你的“Bash Prompt Here”将使用与Windows命令提示符相同的终端,这可以防止水平调整大小。)
要创建一个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上。
创建一个bash文件move.sh,其中包含以下代码 C:\cygwin64\bin\run.exe -p /bin bash runFile.sh 这将启动Cygwin并执行Cygwin bin目录中的runFile.sh 假设你想要导航到一个特定的目录,比如E:\code 那么runFile.sh有如下代码cd E: cd代码
我制作了一个.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"