CMD.EXE Command History Pop-Up

Hey, did you know F7 brings up a command history in CMD.EXE? It’s done that for years, and this was the first I’d ever run into it.

In Unix’s bash shell, for instance, there are some nice features for command line completion. If you type the word history you’ll get a list of the last commands you executed, preceeded by numbers. If you type ! immediately followed by that number, it will re-run that command. If you type ! prefixing the start of some command, it will hunt back through the history and run the first command started with said prefix.

Today while working the XP DOS Box, I bumped a function key and got a pop-up box of my command history. In all my years working with NT, 2000, and XP, I’d never seen that before. So, wanting to recreate it, I researched what it was and how to do it.

The program to thank is DOSKEY. Pressing F7 while at a command problem brings up the command history menu that surprised me. If you already know a command’s number, because you saw it in the list, F9 will let you just enter the number directly. If you type a letter and press F8, it will cycle through all commands starting with that letter.

Pressing ALT-F7 will clear the command history, which on Unix is the same as typing history -c.

Unix has a lot more options when it comes to the history and fc (fix command) than Windows, but it was nice to see a small subset implemented.

Just another small trick to add to the productivity bag.

0 thoughts on “CMD.EXE Command History Pop-Up”

  1. Cool tip! I knew that you could scroll through the history list by using the UP and DN arrow keys, but to see it all at once by using F7 is very nice.

  2. cmd.exe/doskey
    command history

    works for a few commands

    then
    stops working.

    (no problem with doskey *macros*)

    any solution ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.