Windows Console Tricks and Shortcuts

Over the past few days I have been doing a higher than usual amount of work using the Windows console interface. I’ve been at this computing thing for quite some time, easily long enough to be old friends with the venerable DOS style command line, but not so much that I have yet figured out its cryptic emerald emoticon C:\>.

Today, my task involved a considerable amount of copying and pasting to and from the command line. As I am sure you are also painfully aware, the keyboard shortcut Ctrl-v (paste) don’t work at the command line unless your are looking for a shorthand way to enter the 2 character combination “^V” with only the press of two keys. For the first 20 times or so, I simply resorted to my standard approach for cut/paste operations. That is, using the menu from the application icon in the top left corner of the console window as shown here.

Tried and True

Tried and True

This approach is incredibly slow, but I don’t usually do very many clipboard operations at a command line, so I have always just sucked it up and lived with it. Today, however, it was getting extremely tedious and frustrating.

Fed up, I quested a way to use shortcut keys in the console interface for accessing the clipboard. I am sorry to report that I didn’t find it, but did find something almost as good.

Mousing the C prompt? Who Knew?

I don’t know how I didn’t discover this sooner, but you can right-click anywhere on the console window and get a shortcut menu. I suppose the concept of using a mouse at a command line just didn’t occur to me. In any event, using this technique is definitely quicker that my old method because it requires less menu navigation to get to the useful commands.

The copy/cut commands are still a little nonstandard and clumsy given that you must go into “mark” mode before you select the text. Also, marking multiline information is a bit quirky.

Right Clicking in the Console Window Opens a Shortcut Menu

Right Clicking in the Console Window Opens a Shortcut Menu

The “Find” command on this menu is another nice little feature that I had overlooked before. It has two interesting quirks

  • After an unsuccessful find, it emits an extremely loud beep from the built in computer speaker.
  • After a successful find it turns on “Mark” mode to prepare for a copy.

Command History

Most are familiar with using the up/down arrow keys to scroll through previous commands, but how many of you knew you could get a menu of recently used commands by pressing F7? You can reset this history by hitting Alt-F7.

Pressing F7 Opens a Menu of Recently Used Commands

Pressing F7 Opens a Menu of Recently Used Commands

Here are a few more useful keyboard shortcuts that are available in the windows command shell:

  • Up/Down Arrow Keys: Iterate back/forward through command history
  • F1: Paste the previous command one character at a time.
  • F2 (then enter a character):Pastes the previous last command up to, but not including, the first occurance of the provided character.
  • F3: Pastes the previous command in its entirety.

Use Wild cards with the CD command

You are probably used to using wild cards with delete and copy commands, but don’t think about using them to speed up directory navigation.  It can be a real time saver to type “cd doc*” instead of “CD documents and settings.”

You can even use this techniqe when navigating down more than one level, for example “CD win*\system3*” to replace “CD Windows\System32.”

Note:You can’t use a wildcard as the first character with CD for some reason.

Am I the only one who didn’t know about this?

I started to wonder if I was just dense and had missed this feature that everyone in the world knew about except me. I did a quick poll of my peers and discovered that about half of them knew about it, and the other half didn’t know about using my old technique. Out of curiosity, I’d like to see what my readers knew before reading this article.

Do you have any cool command-line tricks to add?

Put them in the comments and I’ll add the good ones to this post.

Further Reading