The other day I discovered that if you hold down the ‘shift’ key whilst right clicking on a directory in the Vista explorer you get a ’Open Command Window Here’ entry in your context menu. You can do this on XP with a PowerToy or some registry jiggery-pokery but it was nice to have it out of the box in Vista.
Having picked up on the excellent ‘Console‘ from Ben’s post the other day I was back to having to ‘cd’ into directories again so set about rummaging in the registry. So… the fruits of my labours:
Add the key – HKEY_CLASSES_ROOT\Directory\shell\open_console
Set the value of that to whatever you want to appear in the context menu e.g. Open Console Here
Under that add the key HKEY_CLASSES_ROOT\Directory\shell\open_console\Command
Set the value of that to the path to your console.exe with the parameters -d %1 In my case that gave me C:\Program Files\Console 2 Beta\Console2\console.exe -d %1
There you go… You should now have the context menu entry. Right click on a directory and open Console on that directory. Coupled with e – texteditor’s “Open as e Project’ you can have your rails set up running in a jiffy.
I would like to add the ability to open a few tabs in Console from the context menu with the same command and maybe start a server running in one and have another ready for commands but I can’t seem to get that going at the moment as I’m no great shakes in the registry. If anyone could point me in the right direction for that I’d be most obliged… In fact, it would be nice to open the ‘e’ project and the Console tabs avec server etc with the one context menu command, perhaps ‘Open Rails Environment’ but maybe I’m getting carried away there…
Had a problem with using the “console here” command when going to a folder with spaces in the path. So I changed the switch to -d “%1″ to get it to work. So C:\Program Files\Console 2 Beta\Console2\console.exe -d “%1″ to use your example.
Just thought I would mention it for anyone who had the trouble and did not know how to fix it. Thanks for the top by the way
.
You can get the same thing in your context menu when you right click in a folder window that’s already open. Just add the same entries to HKEY_CLASSES_ROOT\Directory\Background\shell in addition to HKEY_CLASSES_ROOT\Directory\shell.
Also, if you like having those options only available when you have the shift key depressed (like the stock “Open Command Window Here” menu item, you can add a string value called “Extended” to HKEY_CLASSES_ROOT\Directory\shell\open_console and
HKEY_CLASSES_ROOT\Directory\Background\shell\open_console
Would love to know how to achieve this on WinXP.
I’d also love to see it open a new tab if there was already an instance of Console2 open – and it seems I’m not the only one. I took a look at the tracker and these are relevant:
“Option to restrict to a single running instance”
http://sourceforge.net/tracker/index.php?func=detail&aid=1534902&group_id=43764&atid=437335
“Add ‘Open Console Tab Here’ to Windows Explorer”
http://sourceforge.net/tracker/index.php?func=detail&aid=1586273&group_id=43764&atid=437335
May have to get dirty with the code and see what I can do!
Hello webmaster
I would like to share with you a link to your site
write me here preonrelt@mail.ru
Thanks for the snippet, I was having trouble figuring out how to pass the working directory argument to Console2 and this works like a charm.
Wow, great write up. Was looking to do this and your tutorial was perfect.
I was looking for a way to do this, but for some reason, your solution wasn’t working on system.
I worked around this by replacing the the “cmd.exe” by the path to my console.exe on the windows cmd keys (HKEY_CLASSES_ROOT\Directory\shell\cmd\Command and HKEY_CLASSES_ROOT\Background\shell\cmd\Command)
Nevermind my last comment, it’s wrong.
What I want was to right-clik on a blank space at some folder’s window, and get the option to ‘Open console here’, just like the windows cmd.
Ir order to do that, one must replace the %1 with %V on the windows registry keys. Not it works.
I had to use %V instead of %1 for the “Background”-Version. %1 raised an Error (Win7 64)
Many thanks for the blog owner, Caelum, David Johnston, and bla for your advise. Like many others, I come here through Google and really appreciate your sharing.
And my thanks to all for the tips! My console has never looked or behaved so beautifully! The background menu tip was an awesome boost for another tool I created for grabbing the folder path to the clipboard…!!