Saturday, October 21, 2006

[tools] Adding cygwin to explorer context menu

Cygwin shells are a nice replacement for the standard Win32 console.
However, I had no convenient way of opening a Cygwin console at a given location, in the spirit of the 'Open Command Line Here' XP powertoy.
After playing with bash/rxvt I found a way to do this. Replace your C:\cygwin\cygwin.bat with the following lines:

@echo offC:\cygwin\bin\bash --login -i -c 'cd "`cygpath %1`";rxvt -title \"%1\" -fg white -bg black'
Then open an explorer window (assuming Windows XP), go into Tools -> Folder options, File types, select (NONE) Folder, click on 'Advanced', 'New', give an action name such as 'Open Cygwin shell here' and select C:\Cygwin\cygwin.bat as the program to be launched.

If everything went as planned, you should now have a working 'Open Cygwin shell here' line in your context menu for folders.

Note: I am using rxvt to enable support for escape codes. I am looking for a way to have working escape codes in a Win32 console. If you know how, please drop me an email :-)