How to Launch a Command Prompt from Windows Explorer

Ever find yourself navigating through the file system with Windows Explorer and then want to open up a cygwin shell or windows command prompt in the current folder? Here’s a registry hack that adds a command to the right click popup menu that does just that.

Start up regedit and navigate to:

My ComputerHKEY_LOCAL_MACHINESOFTWAREClassesFoldershell

Create a new Key and call it “Command Prompt” or something like that. Set the “Data” to whatever you want to show up in the menu, “Command Prompt” is what I used.
Then add a new Key under the Command Prompt key and call it “command”. Set the data value to:

cmd.exe /k pushd %1

You can now test it out. Fire up Windows Explorer, pick a folder and right click. You should now see your new command in the menu. Select that menu item and voila: a new windows command prompt opens up in that folder.

For a cygwin shell, set the “Data” value of your “command” key to:

c:cygwinbinbash.exe --login -i -c "cd "`cygpath -u '%L'`" ;bash"

Note: To get this to work on Windows XP 64 bit I had to modify the command to this:

cmd.exe /c c:cygwinbinbash.exe --login -i -c "cd "`cygpath -u '%L'`" ;bash"

You may have to change the path to the bash.exe if you have cygwin installed in a different folder.

Here’s what the popup menu looks like after adding the hack:

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply