How can I create a Cygwin shortcut that will open Cygwin at a specific folder? This would obviate having to type
cd /cygdrive/c/Users/Tom/Desktop/
I used the following lines of code to start zsh in the current directory in Win7.
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'"
note that i used %V instead of %L or %1 (since both didn't work for me)
I use and Icon to launch my cygwin without the chere
package.
C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -c 'cd'
C:\some\dir\name\here
I have made a registry edit script to open Cygwin at any folder you right click. It's on my GitHub.
Here's my GitHub
Sample RegEdit
code from Github for 64-bit machines:
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\""
I had also problem with git, that used to "steal" my cygwin commands - so i needed to run
C:\cygwin\bin\mintty.exe -
but after installing chere
and executing chere -i -t mintty -f
as admin (see above), you can simply use :
C:\cygwin\bin\mintty.exe -e /bin/xhere /bin/bash.exe "."
I added this in Total Commander as custom button (right click on panel > add ...) and it works very well.
When a fresh install is needed, I create a Windows "user environment variable " named HOME
and assigns it the path of wherever "My Documents" reside.
The cygwin installer detects the HOME
variable, automatically translates this into a cygpath and selects this it to be my ~ directory.
This has worked fine for every workstation I have used professionally the last 5 years (about 3 or 4, Win7). I have always been the only user on these machines, cannot say what the effect is.
Open Cygwin terminal as Administrator
In powershell (using chocolatey):
choco install cyg-get
In cygwin Will Install right-click menu
cyg-get install chere
chere -i
Now you can right click and use "Bash Prompt Here" in any folder.