Cygwin: Override Command Here

2010

Windows Vista introduced a nice little feature where Shift+Right Clicking the background in explorer added a “Open command window here” option. Unfortunately for us Cygwin users, this just opens cmd without running bash. Since you probably installed Cygwin for the unix shell, this is kinda annoying. But fear not. I have a hack.

Copy the following into a text file, change its extension to “.reg”, and run it. Make sure to change the path at the beginning if you have a different Cygwin directory. Now “Open command window here” will start the bash shell at the current directory.

Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd \\\"`cygpath -u '%V'`\\\";bash\""
 
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c \"cd \\\"`cygpath -u '%V'`\\\";bash\""

For those of you who like regedit, here’s the same thing unescaped:

HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command
c:\cygwin\bin\bash.exe --login -i -c "cd \"`cygpath -u '%V'`\";bash"
 
HKEY_CLASSES_ROOT\Directory\shell\cmd\command
c:\cygwin\bin\bash.exe --login -i -c "cd \"`cygpath -u '%V'`\";bash"

Have fun!

2 thoughts on “Cygwin: Override Command Here

  1. Pingback: Open bash here (Windows Explorer) : expatiari expatria

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.