CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Darrell Norton's Blog [MVP]

Fill in description here...

Cmd window shortcut shows previously entered commands

I just found a cool cmd window feature (from Windows and .NET Magazine).  If you press F7 in a cmd window, you will get a list of all the previously entered commands in order.  When you can pick one, the cmd window executes it. Try this:

  1. Go to Start/Run
  2. Type in cmd and hit Enter
  3. Type in ipconfig and hit Enter
  4. Type in cls and hit Enter
  5. Now hit the F7 key, and you should see something like this:
     The menu you get when you hit F7 in a cmd window
  6. You can move the selection using the arrow keys.  When the command you want is highlighted, press Enter and it will execute it.

Published Feb 04 2004, 11:42 AM by darrell
Filed under:

Comments

Darrell said:

Same here. If you just want to reuse the previous command, the up arrow works great. But when there are several, or you've used the same command with different parameters, it's easier to use F7.
# February 4, 2004 8:03 AM

Jeff said:

Hasn't this been around since early versions of DOS?
# February 4, 2004 8:22 AM

Julien CHEYSSIAL said:

Wow !!! really didn't know that one !
# February 4, 2004 9:09 AM

Darrell said:

Jeff, sure looks like it doesn't it? Looks like the menu system in the old dos EDIT editor.
# February 4, 2004 9:13 AM

Rob Walker said:

That is pretty slick. I will be showing it to the folks at work tommorow.

On another note.

If you hold down the ALT key and then press the tab key you can switch your focus between running programs.
# February 4, 2004 6:04 PM

Vijay said:

Yeah even i think it's been around for a long time ... It comes with the DOSKEY utility command that comes along with CMD shell. Can't think of exactly when this was introduced but maybe if someone has Win98 or earlier, you can check this out there !
# February 5, 2004 2:30 AM

Vijay said:

In fact F9 lets you go to the command by entering its number in the list ( shown by F7 ).

And Alt F7 clears the buffer that shows all the list of previously executed commands too.
# February 5, 2004 2:32 AM

都こんぶ(猪股健太郎の雑記) said:

F7?????????!
# February 5, 2004 5:51 PM

Mark Hurd said:

Note that these command line editing features are available to other CLI programs too.

I've been using DotLisp interactively through CMD a lot and there's a number of line editing and history shortcuts that are rather useful to remember.

Some of the choice ones:
Up/down arrows - 'scrolls' through command history -- leaves cursor at end of line

F8 - 'cycles' through matches in command history to the text to the left of the cursor -- cursor doesn't move

Ctrl+End - Deletes to the end of the line

Ctrl+Home - Deletes to the beginning of the line.

There are others, like deleting to a character(F4), which are a bit more esoteric and I find I only remember they'd have been useful after I've completed the edit.
# February 6, 2004 12:46 PM

Darrell said:

Mark - very cool. Thanks for all the shortcuts!
# February 7, 2004 4:06 AM

pitiot said:

Yes it is cool but i was looking for a list with this kind of commands not for this command :P Does anybody know where can i find them?
# May 11, 2004 5:43 AM

Darrell said:

Pitiot - I don't know what you are asking for?
# May 11, 2004 6:19 AM

anon said:

For a list of commands, just type the command "help".
# May 21, 2004 5:40 PM
Check out Devlicio.us!

Our Sponsors

Free Tech Publications