Scott Hanselman

Windows 10 gets a fresh command prompt and lots of hotkeys

October 1, '14 Comments [50] Posted in Tools | Win10
Sponsored By
image

Much has been written and much will be written about the Windows 10 announcement.

I'm pretty stoked, and am playing with the Windows 10 Technical Preview now. I can see that there's lots of new enhancements to the shell, the Start Menu/ Screen, how Universal apps work, and so much more. But, let's focus on the "other shell." The console!

The console (conhost) that cmd.exe (often incorrectly but colloquially called the DOS Prompt) and PowerShell live within hasn't had much love in the last several years, IMHO. But then, suddenly, on stage at the Windows 10 announce we've got a VP showing folks that Ctrl-V (paste) works in the command prompt. Why would he do such a crazy thing?

Well, from what I can tell looking at the Preview, there's a LOT of cool Console goodness coming in Windows 10.

Here's a list of hotkeys in the Windows 10 Technical Preview console. This is just hotkeys! Be sure to explore the Properties dialog as well, resize, word wrapping, and more.

Text selection keys

These combinations interoperate with the mouse so you can start selecting with the mouse and continue with one of these commands, or vice versa. 

Selection Key Combination

Description

SHIFT + LEFT ARROW

Moves the cursor to the left one character, extending the selection.

SHIFT + RIGHT ARROW

Moves the cursor to the right one character, extending the selection.

SHIFT + UP ARROW

Selects text up line by line starting from the location of the insertion point.

SHIFT + DOWN ARROW

Extends text selection down one line, starting at the location of the insertion point.

SHIFT + END

If cursor is in current line being edited

* First time extends selection to the last character in the input line.

* Second consecutive press extends selection to the right margin.

Else

Selects text from the insertion point to the right margin.

SHIFT + HOME

If cursor is in current line being edited

* First time extends selection to the character immediately after the command prompt.

* Second consecutive press extends selection to the left margin.

Else

Extends selection to the left margin.

SHIFT + PAGE DOWN

Extends selection down one screen.

SHIFT + PAGE UP

Extends selection up one screen.

CTRL + SHIFT + RIGHT ARROW

Extends the selection one word to the right.

CTRL + SHIFT + LEFT ARROW

Extends the selection one word to the left.

CTRL + SHIFT + HOME

Extend selection to the beginning of the screen buffer.

CTRL + SHIFT + END

Extend selection to the end of the screen buffer.

CTRL + A

If cursor is in current line being edited (from first typed char to last type char) and line is not empty and any selection cursor is also within the line being edited

Selects all text after the prompt.  (phase 1)

Else

Selects the entire buffer.  (phase 2)

Extra Fun with CTRL + A

CTRL + A behavior is interesting. Regardless of the state of mark mode and quick edit mode, one of two things should happen. Either the entire buffer is selected, or (only in a single case) '2-Phase select' starts.  2-Phase select is the process where the first CTRL-A selects the characters to the right of the edit line prompt, and the second press selects the entire buffer.

Editing keys

As I mentioned above you can copy and paste text with the keyboard. When copying text, you might worry that CTRL + C has always been the BREAK command. This is a nice touch, it will still send the break signal to the running application when no text is selected. The first CTRL-C copies the text and clears the selection, and the second one signals the break. Nice attention to detail, IMHO.

Editing Key Combination

Description

CTRL + V

Paste text into the command line.

SHIFT + INS

Paste text into the command line.

CTRL + C

Copy selected text to the clipboard.

CTRL + INS

Copy selected text to the clipboard.

Mark mode keys

These keys function in mark mode. You can enter this mode by right-clicking anywhere in the console title bar and choosing Edit->Mark from the context menu as before, or via the new shortcut combination, CTRL-M. In the original console, mark mode resulted in block mode text selection. While in mark mode, you can hold down the ALT key at the start of a text selection command to use block mode in the new console. The selection key combinations above are all available in mark mode. CTRL + SHIFT + ARROW operations select by character and not by word while in mark mode.

Mark Mode Key Combination

Description

CTRL + M

Enter "Mark Mode" to move cursor within window.

ALT

In conjunction with one of the selection key combinations, begins selection in block mode.

ARROW KEYS

Move cursor in the direction specified.

PAGE KEYS

Move cursor by one page in the direction specified.

CTRL + HOME

Move cursor to beginning of buffer.

CTRL + END

Move cursor to end of buffer.

History navigation keys

Navigation  Key Combination

Description

CTRL + UP ARROW

Moves up one line in the output history.

CTRL + DOWN ARROW

Moves down one line in the output history.

CTRL + PAGE UP

Moves up one page in the output history.

CTRL + PAGE DOWN

Moves down one page in the output history.

Other keys

Other Key Combination

Description

CTRL + F

Opens "Find" in console dialog.

ALT + F4

Close the console window, of course!

If you are like me and also love the console and want it to get even better, head over to the Windows Command Prompt Uservoice and be heard!

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 ORCS Web
Wednesday, October 01, 2014 6:16:09 PM UTC
This is just hotkeys! Be sure to explore the Properties dialog as well, resize, word wrapping, and more.


Does this mean real-time resizing of the dialog without going into settings and having the terminal resize as well? Please say yes.


John Hargrove
Wednesday, October 01, 2014 6:21:37 PM UTC
Great info.. Thanks Mate!
Preetham Reddy
Wednesday, October 01, 2014 6:23:55 PM UTC
Scott, would you wait for 10 or go to 8.1 soon, to get a taste of it, before 10 arrives? I have Win7 pro on my Lenovo with upgrade to 8.1 available. Admittedly, Win7 works perfectly for me, but now I'm wondering if I shouldn't get on 8.1 sooner.

Thanks! Love your tweets and blog, man!
Paul
Wednesday, October 01, 2014 6:46:57 PM UTC
I just found this one today and I like it. I'm not sure which version of Windows it was introduced with, but in cmd and powershell if you have history in that window you can hit F7 and menu pops up that lets you see your previous command line operations and you can select them. Similar to up and down in the command line, but with a little gui.
Davin Studer
Wednesday, October 01, 2014 6:53:19 PM UTC
yah, it's inexplicable (at least to me) why there's so many new shortcuts to the command window in Win 10

I use it quite a bit as an IT guy but I can't imagine many others even knowing that it exists...

I think it was Win 7, where F2 on a file, selected the text of the file without the file extension...Anyway, that was worth the upgrade for me right there :)

Looking forward to Ctrl + V

Taki
Taki
Wednesday, October 01, 2014 7:13:14 PM UTC
Since the introduction of PowerShell (which has been an amazing addition to the platform), I've always wondered if/when Microsoft would replace what we know as the cmd.exe with PowerShell. From a user experience perspective this seems logical to me.

There are few things that I run directly within cmd.exe. PowerShell has overwhelmingly taken its place.

Windows 10 doesn't seem to be replacing cmd.exe, just giving it a face lift. Is that everyone's take so far?
Wednesday, October 01, 2014 7:34:31 PM UTC
David Studer - That F7 history was added in DOS 4.0, as I recall. Really.
Scott Hanselman
Wednesday, October 01, 2014 7:50:02 PM UTC
@John Hargrove
yes, i just verified it myself :)

Also, if the hotkeys are not working, you migh have to go into properties and then the experimental tab and enable all the new stuff. i suspect they were not enabled by default for me because i upgraded an exsisting win 8.1 install. (this worked flawlessly by the way, all apps works including desktop ones, VS, gdrove, dropbox, everything)
aL
Wednesday, October 01, 2014 7:51:48 PM UTC
Word wrapping is my favorite so far, plus it's now dynamic as you resize the window
aL
Wednesday, October 01, 2014 8:30:49 PM UTC
aL,

Thank you. I just installed the preview and saw it myself. Living in the future!
John Hargrove
Wednesday, October 01, 2014 8:50:25 PM UTC
Big smile. Very happy about the direction Windows Two (10) is taking. ;-)
Wednesday, October 01, 2014 8:53:43 PM UTC
The considerably different behaviors of Ctrl+C depending on whether there's a selection or not makes me nervous.

I'm sometimes in the habit of hitting Ctrl+C to clipboard copy multiple times in a row, due to some old application or PC -- don't remember which at this point -- that had a bad habit of not actually performing the copy on the first Ctrl+C press. Guess I'll need to break that habit!

It'll be weird, but nice, not having to do Alt+Space,E,P to do a clipboard paste in the console anymore!
Wednesday, October 01, 2014 8:57:55 PM UTC
Well the real improvement I have been waiting for, and not sure if it's included in the new enhancements, is the ability to keep history from previous console sessions. Linux has the ability to do this but in all this time the buffer of the command prompt is flushed when you exit the session...
Chris
Wednesday, October 01, 2014 9:13:27 PM UTC
Does it persist your command history between sessions? /want
Dan
Wednesday, October 01, 2014 9:27:13 PM UTC
Still waiting for 'set -o vi' support.
Ben
Wednesday, October 01, 2014 9:36:11 PM UTC
I think I read about clink on your page years ago, and have been using it since.
Charlie Maggot
Wednesday, October 01, 2014 10:29:25 PM UTC
@John apparently it does, I tweeted a post from Rafael Rivera that covers some of the other features https://twitter.com/lavinski/status/517118565871140864
Wednesday, October 01, 2014 11:24:47 PM UTC
@Scott Hanselman Since DOS 4.0!!! Ok, I feel sheepish. Now I feel like I should remove my pocket protector and hand in my nerd badge. I still like it though.
Davin Studer
Thursday, October 02, 2014 1:54:08 AM UTC
The biggest thing missing from the windows command shell is persisting command history across sessions (shell / machine restarts)
Eric
Thursday, October 02, 2014 2:27:27 AM UTC
Who uses CMD.exe anyway? Between Conemu and the numerous shells it can manage - git bash, TCC/LE, Powershell, etc... I haven't cracked open CMD in ages.

Jim Priest
Thursday, October 02, 2014 3:10:01 AM UTC
@Scott Saad: it's a facelift for conhost, the console host window -- this improves both PowerShell and CMD (and wmic, netsh, wmic, etc.) also. It's not really touching cmd.exe (at least, not so far).


Also, @Scott, you missed Ctrl+X (which oddly, copies, even in the prompt bug here) and Ctrl+Backspace (which isn't new, but ought to be on the list for completeness sake?)
Thursday, October 02, 2014 3:47:04 AM UTC
To be honest, I was more impressed with ability to resize the window and have the contents wrap correctly. Hotkeys are nice too... I'm just so used to the way the console host does things that it just doesn't irritate me any more.
Nacimota
Thursday, October 02, 2014 4:00:38 AM UTC
Hope they kept F7
Pedro
Thursday, October 02, 2014 5:30:34 AM UTC
Have they finally changed the god awful backspace path separator to forward slash? This got to be the #1 most annoying thing about Windows ever. And it gets even worse when you have spaces in your folder names. 40 years and it still can't beat the ole * nix prompt
steve
Thursday, October 02, 2014 8:47:25 AM UTC
I just installed the technical preview on a Hyper-V machine, and I don't have any of those hotkeys in the command line over there. Am I missing something? Will it be available in future previews only?
Noam Gal
Thursday, October 02, 2014 9:43:25 AM UTC
OK.
I just got my VM into our domain, and logged in using my domain user, and the command line now works as mentioned in this post.
For some reason it seemed like the good old command line in the other user (using a Microsoft account for login). I wonder why there is such a difference.
Noam Gal
Thursday, October 02, 2014 10:03:15 AM UTC
Finally shell gets an update.
I hope it saves me from jumping to Ubuntu.
Thursday, October 02, 2014 12:52:12 PM UTC
i'm curious as to what convinced the Windows team to spend some time on the command prompt. i figured that as *the developers of Windows* they would be using the command prompt enough to fully experience its pain points ("You mean CTRL-V doesn't paste, like everything else in Windows?").

Does anyone have any ideas of why this would get attention now? Is it part of their marketing effort to reach out to enterprise-y customers?

As someone who breaks into powershell almost daily, i'm excited to see it improve!
Thursday, October 02, 2014 10:20:33 PM UTC
No. Doskey was only since DOS 5.0. So don't feel so bad @Davin Studer... ;)
PRMan
Friday, October 03, 2014 12:30:44 AM UTC
Still waiting for delete key in IE URL edit field to not go to the prior web page visited. It's a text editing field.

cmd.exe - still a compelling reason to use it for this instead of RE:
findstr /S /I /P pattern | findstring /i abc | findstring /v def | findstring /v ....

Greg
Friday, October 03, 2014 4:50:20 AM UTC
Does the new conhost finally show complex scripts?
Raj Chaudhuri
Friday, October 03, 2014 9:03:09 AM UTC
Will we get 256 colors and ANSI/VT100 color support so that terminal vim and other (bad ports of) linux tools become usable?
Bart
Friday, October 03, 2014 1:23:44 PM UTC
Yeah, finally. That are really great news.
Friday, October 03, 2014 2:24:01 PM UTC
This is very, very long overdue. It really should have been done alongside the initial introduction of Powershell; here we have a command-line shell which lives up to the "power" name, good enough to be worth using for a lot of tasks, but it's been hobbled since its inception by probably the worst console I've used in any desktop OS.

Glad they've realized that there is a place for a usable command line in a modern OS.
Friday, October 03, 2014 4:32:38 PM UTC
I'm experiencing very buggy issues with fonts and window size on a Surface Pro set to 150% scaling. Every time I open Properties, the window size and font seems to change... and it doesn't seem to really respect my selections. I'm sure it's a display scaling issue though, as most people run at 100% and most people aren't reporting any issues. But click the layout tab and change the font or window size, hit OK, and things get weird.

The "transparency" feature is also interesting.
pmbAustin
Friday, October 03, 2014 8:17:30 PM UTC
Also good to note that the ^ commands (^C, ^A, ^V) continue to work as normal when their new behavior doesn't make sense (CTRL+C still aborts if you don't have a selection), and that you can always get the old behavior of ^KEY by doing CTRL+SHIFT+KEY.
Friday, October 03, 2014 8:22:20 PM UTC
Bad example -- CTRL+SHIFT+C doesn't do anything special. This works for ^A, ^V, and ^F.
Saturday, October 04, 2014 1:41:26 PM UTC
Hi Hansel man, seems you are missing hot keys to increase or decrese the Opacity
Ctrl + Shift + Plus
Ctrl + Shift + Minus
key combination does it, even when "Enable experimental console features" is set to off.
Isham Mohamed
Monday, October 06, 2014 1:37:48 AM UTC
Cue hundreds of confused people wondering what the hell "conhost" is since "powershell runs in a cmd window."
Monday, October 06, 2014 3:35:03 PM UTC
Is there a way to request features for core windows features like file explorer? I hate having to install shell replacements (to get dark backgrounds, tabbed interfaces, jumplists, locked tabs) or having to use clipboard history managers like Ditto.
Luke
Tuesday, October 07, 2014 8:04:55 AM UTC
I can't tell if it's more funny or sad that (nearly) all the Linux weenies so far don't know the difference between the terminal / console and the shell / command prompt. (I say as a Linux weenie). Probably sad, since it happens every single time, Scott even pointed it out in this post.

I put this on my Surface pro 2, but I've not had much chance to play around with it yet. I'm interested to see if there are any new apis for being able to write a console replacement (or other rehosting use cases, for example a terminal pane in an IDE.)
Simon Buchan
Tuesday, October 07, 2014 9:50:47 AM UTC
You can have a lot of this, if not all (e.g. the Ctrl+C behavior), in the classic conhost with the PSReadLine Powershell module. Plus the command history persisting between sessions, Emacs & custom shortcuts or syntax highlighting.
Petr
Thursday, October 09, 2014 2:20:41 PM UTC
Just installed the win 10 preview (did a new install over an old install, so I have windows.old, etc.) and the command prompt is acting exactly the same. None of the new features talked about here are working.

I did just clean out some adware, maybe that has something to do with it.

DOS prompt is saying:

Microsoft Windows [Version 6.4.9841]
(c) 2014 Microsoft Corporation. All rights reserved.

Is that right for the win 10 preview build?
Friday, October 10, 2014 8:02:37 PM UTC
What happens if you type in the following text?


env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

ErnestedCode
Wednesday, October 15, 2014 8:33:45 PM UTC
Hi Bryan,

Make sure you go into cmd's properties and the "experimental tab" and turn on the new keyboard shortcuts and opacity.

Hope this helps!
John Stevans
Saturday, November 15, 2014 10:20:18 AM UTC
Great News!!!!!!!!!!!!!!
Gurwinder
Wednesday, November 19, 2014 9:09:34 AM UTC
Great list of shortcut keys Hanselman. I'm saving this list of shortcut and hotkeys in advanced so the task is more easier whenever I upgrade my system to Windows 10.
Alex
Friday, December 05, 2014 5:14:30 PM UTC
Scott nice tutorial tnx.
how toget offline preview builds of windows technical preview .
Wednesday, December 17, 2014 10:57:12 AM UTC
very nice
Wednesday, December 24, 2014 7:32:25 PM UTC
Microsoft has also released a new Windows 10 preparation tool for Windows 7 and 8 users.
Comments are closed.

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