Scott Hanselman

Quake Mode Console for Visual Studio - Open a Command Prompt with a hotkey

January 21, '15 Comments [45] Posted in Tools | VS2012 | VS2013 | VS2015
Sponsored By

Back in March of 2013 when Phil Haack was deep into GitHub for Windows development we were going back and forth in email about how to quickly get into a shell from a specific project. I hate always having to paste in a "CD somedirectory" so I usually use some kind of "Command Prompt Here" right click menu.

TIP: A lot of people don't realize that you can Shift-Right-Click on a folder in Windows Explorer and you'll automatically get a "Command Prompt Here" menu item!

Anyway, Phil and I were emailing and he said (remember that GitHub for Windows (GHfW) was in development)...and I've always loved how the Quake console pops up when you press ~ in Quake.

I feel ashamed I didn't know this, but I just discovered that CTRL+ALT+D brings up the shell when in GHfW. We are considering ways to make our keyboard shortcuts more discoverable. Kind of like the `?` support we have on We should totally make that a ~ shouldn't we? Like in Quake, Doom, etc.

And they did. When you're in GitHub for Windows just press ~ and you'll automatically get a new command prompt (or Bash Shell or PowerShell) and be dropped in to the current folder's directory. It's my most favorite feature about GitHub for Windows.

I mentioned this to Mads Kristensen yesterday and said we should build this feature into Visual Studio. Rather than waiting, he just created a little single purpose extension called Open Command Line. It works in Visual Studio 2012, 2013, and 2015.

Open Command Line

But it's the hotkeys that make it awesome. Now I'm not sure how I lived without it. Alt-Space and it opens up a prompt right where I need it. Go download the Open Command Line free Visual Studio extension now, and remember, it works in Visual Studio Community which is also free! You can set it to open CMD, PowerShell, or a custom prompt.

Oh, by the way, the overlay there that shows what hotkey I'm using, that's Carnac.

Related Links

Sponsor: Big thanks to the folks at Infragistics for sponsoring the feed this week! Responsive web design on any browser, any platform and any device with Infragistics jQuery/HTML5 Controls.  Get super-charged performance with the world’s fastest HTML5 Grid - Download for free now!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Wednesday, January 21, 2015 8:52:25 AM UTC
OMG, Carnac... I was looking for such a util for ages and all others sucked.. no idea how I managed to not come by it sooner! Thank you!
Wednesday, January 21, 2015 8:53:31 AM UTC
That Phil Haack guy is so cool and dreamy.

-totally not Phil Haack. Unbiased observer.
Wednesday, January 21, 2015 9:05:20 AM UTC
Hm, my old Quake-style gravatar would have been more fitting.. :)
So, would this open a cmd prompt, or can it be configured to open a PoSh-prompt?
Wednesday, January 21, 2015 9:06:37 AM UTC
Frank - Of course!
Scott Hanselman
Wednesday, January 21, 2015 10:00:28 AM UTC
How did you record the gif? I'm using ShareX, but always looking for (better?) alternatives.
Wednesday, January 21, 2015 10:06:54 AM UTC
When you're in GitHub for Windows just press ~ and you'll automatically get a new command prompt

It doesn't work on a French keyboard (AZERTY). On those keyboards the upper-left key is '²' (not sure why someone thought we needed this character directly accessible). The '~' character is accessible through AltGr+2, but since it's a dead char, it doesn't work as a shortcut key...
Wednesday, January 21, 2015 10:21:21 AM UTC
So to open a console, you have to use...
~ in Quake
Alt+Space in VS
F12 in IE and Chrome

Life would be easier if all of them could agree to use a standard shortcut.
Stefan Offermann
Wednesday, January 21, 2015 10:23:57 AM UTC
I don't think 'Alt+Space' is a good key choice, as it just takes a shortcut that is reserved by Windows since at least 3.0: It should open the system menu, as it always did.
Bert Huijben
Wednesday, January 21, 2015 10:23:58 AM UTC
Thanks to Mats for building this extension! Installed.
Wednesday, January 21, 2015 11:23:01 AM UTC
And Microsoft should decide if we should use command line or PowerShell...
Wednesday, January 21, 2015 11:34:38 AM UTC
I just discovered recently that ConEmu has a quake mode. It makes ConEmu appear from the top of the screen, and hides/show it with the Ctrl+` shortcut (as in Sublime Text). The shortcut is configurable.

You can see how to activate this mode here:
Melchior Corgié
Wednesday, January 21, 2015 11:52:24 AM UTC
Not working for me - The parameter is incorrect (Exception from HRESULT: 0x80070057 (E_INVALIDARG).

John Francis
Wednesday, January 21, 2015 12:19:40 PM UTC
On UK keyboards its the `¬¦ key (top left, underneath the Esc key).
Richard Price
Wednesday, January 21, 2015 12:27:08 PM UTC
That key (tilde?) is not available on various international keyboards. For example as a kid, playing Quake, I could never try the various che... options, because I could not access the console.
El Dorko
Wednesday, January 21, 2015 1:06:16 PM UTC
Why do you need a command prompt at a project's location so often?
Wednesday, January 21, 2015 1:18:45 PM UTC
"A lot of people don't realize that you can Shift-Right-Click on a folder in Windows Explorer and you'll automatically get a "Command Prompt Here" menu item!"

Count me among them. Thank you so much.

(Not a great fan of non-discoverable features)
Rob G
Wednesday, January 21, 2015 1:27:21 PM UTC
@El dorko - see Richard Price's comment right above yours.
Rob G
Wednesday, January 21, 2015 1:53:15 PM UTC
Awesome!! Just installed works like a charm!

Great work Mad and Scott!!
Wednesday, January 21, 2015 3:12:43 PM UTC
I always opened a command prompt in a specific folder by typing cmd and pressing enter in the Explorer address box. So I'd right-click my project and Open Folder in File Explorer, then type cmd and press Enter in the address box. It opens the command prompt with the path set to the current folder.
Wednesday, January 21, 2015 3:22:02 PM UTC
Submitted a pull request to have an option to always open at the solution level if desired, hopefully he'll accept it, I can't think of a reason in my development why I'd want to be at the project level.
Wednesday, January 21, 2015 3:27:48 PM UTC
I'm using a conEmu prompt. If I make the command: c:\path\to\conemu\prompt it doesn't open in the project/solution directory. I've been trying to pass it the solution path via Command arguments with $(SolutionPath), but that doesn't seem to work. Any suggestions or thoughts?
Wednesday, January 21, 2015 4:38:54 PM UTC
I normally use WinKey+x -> a. Downside is it defaults to \windows\system32. Upside is it's running as admin. I also set it to launch powershell instead of cmd.
Dan Tower
Wednesday, January 21, 2015 4:43:37 PM UTC
Anything Scott, Phil and Mads like is cool, but you can already do the same with Visual Studio's "External Tools" in the Tools menu. I have a "CMD Here" item, mapped to Ctrl+`, which opens a command prompt to the path of the currently selected item (file, project, etc.). Using external tools, this would also get saved in your exported settings when moving to a new machine or upgrading to future VS versions. (The extension's settings may as well -- I don't know.)
Wednesday, January 21, 2015 6:43:31 PM UTC
@Ben - The extension forwards the directory path as the current working directory of a newly spawned process, rather than a token like $(SolutionPath). You can get the working directory of the ConEmu process with %ConEmuBaseDir% from within ConEmu, so you can use this to get your shell set. So, if you have a ConEmu task named "{PowerShell}", configure the extension to pass along
/cmd {PowerShell}
to the ConEmu64.exe. Then, within that task, have command simliar to
powershell.exe -Command "& %ConEmuBaseDir%"
and you should get your PowerShell process set to the correct directory.
Wednesday, January 21, 2015 10:03:52 PM UTC
@Andy i do the same thing, it works great! It also works for 'powershell' to :)
Thursday, January 22, 2015 1:18:01 AM UTC
wow, thanks for sharing
Thursday, January 22, 2015 1:36:24 AM UTC
The Productivity Power tools command extension has a open command prompt feature that opens a command prompt in the selected location. Although I don't Think you can map it to anything but cmd.exe
Niclas Lindgren
Thursday, January 22, 2015 12:51:05 PM UTC
1. How can I set to powershell ? ( gives an error - however it can be installed in VS)

2. With which tool did you make the animated gif?

Thank you
Thursday, January 22, 2015 3:32:51 PM UTC
TIP: A lot of people don't realize that you can Shift-Right-Click on a folder in Windows Explorer and you'll automatically get a "Command Prompt Here" menu item!

Awesome tip ;)
Thursday, January 22, 2015 11:41:09 PM UTC
I always loved the Quake console as well.

On my Mac I use TotalTerminal to get the same effect.

I wish it were easy to get the same thing in Windows.
Friday, January 23, 2015 12:54:33 PM UTC
As usual is a pleasure to read your blog.
Friday, January 23, 2015 3:22:16 PM UTC
I don't need a command prompt here very often but I do seem to want to open File Explorer here quite a bit. Good news is there's already an Open Containing Folder command in Visual Studio, I bound it to Ctrl+Shift+Alt+O (because every two-modifier-key combination with O is taken). From there, the shift-right-click, command prompt here is available.
Friday, January 23, 2015 7:17:31 PM UTC
+1 for leaving Alt+Space assigned to the System menu, like it has been for years and years, for every Windows application.

Am I the only one that regularly uses:

Alt+Space, x - Maximize window
Alt+Space, n - Minimize window
Alt+Space, r - "Restore" (Unmaximize) window
Alt+Space, m - Move window (For when the window somehow gets stuck offscreen and can't be reached with the mouse, and needs to be rescued using the keyboard.
Saturday, January 24, 2015 7:57:30 AM UTC
If you use Console or ConsoleZ, I recommend to take a look at this extension from Grzegorz Kozub. Since I usually have several shells and prompts open at the same time in tabs this extension allows you to open them all at once or just a couple. You can create any keyboard shortcut you want for it too.
Juan Valenzuela
Saturday, January 24, 2015 4:58:03 PM UTC
This is useful - a question though, is anybody aware of a way to access the Git command line in VS2015 for the current Project..? Perhaps I can add it as an external tool and pass parameters, but I was wonderful if there was an extension for this that is a neater solution. Any advice appreciated...
Saturday, January 24, 2015 5:16:42 PM UTC
Ok, I should have looked closer... and found GitTools extension:

Seems to do the trick!
Sunday, January 25, 2015 12:51:09 AM UTC
I know you are a fan of ConEmu and Clink so you might be interested in Cmder -

It's a nice re-packaging of ConEmu, Clink and MsysGit and it can be easily configured to be a Quake style console. It has themes and uses Monokai by default so it looks pretty(ish) from the start.
Tuesday, January 27, 2015 4:52:20 PM UTC
It is a good idea.
But, I can't use with Visual Studio Express 2013 to Web. I cried!
Leandro Souza
Wednesday, January 28, 2015 12:49:50 PM UTC
I use stexbar for windows explorer. It has a button to open a console in the directory you are in, cmd or powershell.

Also you can install it using Chocolatey cinst stexbar or choco install stexbar
Adam Wright
Thursday, January 29, 2015 5:48:09 AM UTC
Alt+Space is used by Launchy
Friday, January 30, 2015 4:31:30 AM UTC
Sweet... Funny blogged about adding that as an external command with a hotkey last week or so: which is similar except it gives you a little more control over what to shell to (Console2 for me specifically).

But you know what would be even better - is have Console support in a window like WebStorm does. While it seems like a little thing, having the command window right within the IDE and maybe active in a side panel is really nice instead of hunting around on the desktop through 20 windows to find the CLI...

Saturday, January 31, 2015 4:24:13 PM UTC
I concur with previous comments about the functionality loss incurred by conflicting with the 25-year-old Alt+Space keyboard shortcut. I put an issue in GitHub that describes the concern.
Sunday, February 01, 2015 11:33:18 AM UTC
If you want to open the Git Shell installed by GitHub for Windows, set up the options as follows:

Command: powershell.exe

Command Arguments (single line):

-ExecutionPolicy Bypass -NoExit -Command .(Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1"); .(Resolve-Path "$env:github_posh_git\profile.example.ps1")
Monday, February 02, 2015 4:31:50 PM UTC
Also, in windows explorer you could use autohotkey script for this. Explanation here.
Friday, February 06, 2015 8:06:43 PM UTC
Be even more awesome if it opened it in a nice GUI style and it slid in and out of the top.. Instead of launching a new one every time ... And such :)
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.