Scott Hanselman

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

January 21, 2015 Comment on this post [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 GitHub.com. 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
Hosting By
Hosted in an Azure App Service
January 21, 2015 12:52
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!
January 21, 2015 12:53
That Phil Haack guy is so cool and dreamy.

-totally not Phil Haack. Unbiased observer.
January 21, 2015 13:05
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?
January 21, 2015 13:06
Frank - Of course!
January 21, 2015 14:00
How did you record the gif? I'm using ShareX, but always looking for (better?) alternatives.
January 21, 2015 14:06
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...
January 21, 2015 14:21
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.
January 21, 2015 14:23
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.
January 21, 2015 14:23
Thanks to Mats for building this extension! Installed.
January 21, 2015 15:23
And Microsoft should decide if we should use command line or PowerShell...
January 21, 2015 15:34
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: http://tech.pro/blog/1239/conemu-quake-style-consoles
January 21, 2015 15:52
Not working for me - The parameter is incorrect (Exception from HRESULT: 0x80070057 (E_INVALIDARG).

VS2013
January 21, 2015 16:19
On UK keyboards its the `¬¦ key (top left, underneath the Esc key).
January 21, 2015 16:27
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.
January 21, 2015 17:06
Why do you need a command prompt at a project's location so often?
Jon
January 21, 2015 17:18
"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)
January 21, 2015 17:27
@El dorko - see Richard Price's comment right above yours.
January 21, 2015 17:53
Awesome!! Just installed works like a charm!

Great work Mad and Scott!!
January 21, 2015 19:12
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.
January 21, 2015 19:22
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.
January 21, 2015 19:27
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?
Ben
January 21, 2015 20:38
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.
January 21, 2015 20:43
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.)
January 21, 2015 22:43
@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.
January 22, 2015 2:03
@Andy i do the same thing, it works great! It also works for 'powershell' to :)
January 22, 2015 5:18
wow, thanks for sharing
January 22, 2015 5:36
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
January 22, 2015 16:51
1. How can I set to powershell ? ( https://visualstudiogallery.msdn.microsoft.com/4e84e2cf-2d6b-472a-b1e2-b84932511379 gives an error - however it can be installed in VS)

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

Thank you
January 22, 2015 19:32
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 ;)
January 23, 2015 3:41
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.
January 23, 2015 16:54
As usual is a pleasure to read your blog.
January 23, 2015 19:22
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.
January 23, 2015 23:17
+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.
January 24, 2015 11:57
If you use Console or ConsoleZ, I recommend to take a look at this extension https://visualstudiogallery.msdn.microsoft.com/1460ab21-75be-49d0-900f-dfd538321424 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.
January 24, 2015 20:58
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...
January 24, 2015 21:16
Ok, I should have looked closer... and found GitTools extension:

https://visualstudiogallery.msdn.microsoft.com/48c3e91e-d1d7-4bf9-84dd-d3b97e2d5922?SRC=VSIDE

Seems to do the trick!
January 25, 2015 4:51
I know you are a fan of ConEmu and Clink so you might be interested in Cmder - http://bliker.github.io/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.
January 27, 2015 20:52
It is a good idea.
But, I can't use with Visual Studio Express 2013 to Web. I cried!
January 28, 2015 16:49
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
January 29, 2015 9:48
Alt+Space is used by Launchy
January 30, 2015 8:31
Sweet... Funny blogged about adding that as an external command with a hotkey last week or so: http://weblog.west-wind.com/posts/2015/Jan/09/Tip-Create-a-Visual-Studio-Menu-option-to-Open-a-Command-Window 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...



January 31, 2015 20:24
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.
February 01, 2015 15:33
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")
February 02, 2015 20:31
Also, in windows explorer you could use autohotkey script for this. Explanation here.
February 07, 2015 0:06
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.