April 7, 2014

Command Prompt Tricks and Hacks

Become a Command Prompt Power User with Function Keys

Command Prompt Function Keys - Command Prompt Tricks
The fact that the function keys actually do something in the Command Prompt is maybe one of the best kept secrets about the tool:
F1: Pastes the last executed command (character by character)
F2: Pastes the last executed command (up to the entered character)
F3: Pastes the last executed command
F4: Deletes current prompt text up to the entered character
F5: Pastes recently executed commands (does not cycle)
F6: Pastes ^Z to the prompt
F7: Displays a selectable list of previously executed commands
F8: Pastes recently executed commands (cycles)
F9: Asks for the number of the command from the F7 list to paste
Command Prompt Trick #17 is full of arrow key shortcuts, a few of which are similar to these function key tricks.

Copy From the Command Prompt

Mark Feature in Command Prompt - Command Prompt Tricks
As you may or may not know, copying from the Command Prompt is not as easy as copying from other programs, which is part of the reason why saving a command's output to a file, Command Prompt Trick #7, is so handy.
But what if you do just want to copy a short section of text to the clipboard? It's not too hard but it's not very intuitive either.
Right-click anywhere in the Command Prompt window and choose Mark. Now, highlight with your left mouse button whatever you'd like to copy. Once your selection is made, press Enter.
Now you can paste that information into whatever program you'd like.