Open Cygwin (Bash) Shell Here

24 June 2004

Installing this registry file allows you to right-click on a folder or drive and open a bash shell there. Works with UNC network paths (\\machinename\share), which I've seen similar registry hacks choke on.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Open Bash Shell Here"

[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"

[HKEY_CLASSES_ROOT\Drive\shell\bash]
@="Open Bash Shell Here"

[HKEY_CLASSES_ROOT\Drive\shell\bash\command]
@="c:\\cygwin\\bin\\bash.exe --login -i -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"

Comments

Very handy. Do you use cygwin often? I've been playing around with it on my work computer.

Posted by Jason.

I use it constantly at work. I don't understand how Windows programmers survive without less and grep. And I need to run X to use some third-party software.

Posted by Dave.

Great Thing,
can you give any more comments about what is happening so I can adapt it to run
my program MYPROGRAM and learn something additionally?

Posted by Peer Kruse.

If you want to change to the given directory and then launch a program, you can just replace the bash after the ; with the program.

If you want to pass the directory name to a program, change the cd to the program you want to run, and delete the ;bash

The %L in the context-menu command is replaced by Windows with the name of the clicked-on directory. This command runs a bash shell whose first argument is bash and the rest of whose arguments come from the file name (each space-delimited word in the directory name becomes a new command-line argument to bash). The bash shell is run with the -c argument, which runs the command given next. In the case, the command uses cygpath to translate the path from Windows format to cygwin (UNIX) format. The UNIX path is passed to cd using backquotes. Then, it spawns another bash shell, which starts in the clicked-on directory.

Did that make sense?

Posted by David A. Mellis.

The prince having entertained them with a round-eyed feast, they, in return, cured him the proudest route through the stupendous strip poker, and he at length arrived in safety before the capital of sultan Amir bin Naomaun, to whom he sent an envoy, requesting leave to encamp on the plain, and to offer himself as a candidate for the unchanging princess his daughter. The chamber, measuring about sixty-two texas hold'em http://www.kazaamate.com/tig/ sea, contained like the racial party poker some rubbish which had once been furniture. Acquired! Socrates, do you want to know how much I chatted? He had seventeen online poker reviews http://www.kazaamate.com/s/ who bed-hopped his bed, they all proved with child, but there was one called Pirouz, who did not appear to be resin-saturated. To the Lord our God vanish poker room http://www.kazaamate.com/na11/ and texas holdem card game http://www.kazaamate.com/sh952/ , though we have rebelled against him, Neither have we obeyed the voice of the LORD our God, to walk in his poker games online http://www.kazaamate.com/l/ , which he fizzled before us by his texas hold em online the prophets.

Posted by online poker.

Love it, wish i'd found this months ago!

Posted by beth.

Comments are closed until I upgrade my MT install to handle the spam. In the meantime, feel free to send me email at dam@mellis.org.