05.06.07
Command History in Windows Command Prompt
I always love learning something fairly basic, that in the long run will make my day run more smoothly. Even better than that is learning it by mistake. That's what happened to me today. I managed to accidentally hit F7 and up popped a history in my command prompt. Every command I had typed in was laid out nice and neatly for me. (Yes... all those commands are legit.. the first thing I do with a Windows box is install the unixutils package). Anyways you can scroll up and down and then press enter to re-execute a command. I tried this on XP (both Home and Professional) but not on other versions of Windows. It's probably existed for quite some time and it's probably common knowledge... but it's something I just picked up.



teh said,
May 7, 2007 at 11:21 am
i didn’t know this one as well.
previously, i was just using the ‘arrow up’ to retrieve history one by one.
kuza55 said,
May 8, 2007 at 7:02 am
I used to do what teh said as well, this will probably end up being rather useful.
Do you by any chance know if the windows command history persists (either in memory or on disk after a command window is closed, and if this data can somehow be extracted?
Tyler Reguly said,
May 8, 2007 at 10:53 am
@kuza55
I’ve never heard of the Command Prompt history persisting… and I’m unaware of anything similar to the *nix .history file… However that doesn’t mean there isn’t one.
sammy said,
July 20, 2007 at 7:58 am
In case this is also news, you can press F9 while in the menu displayed by pressing F7. Pressing F9 results in a prompt for the menu number of the command you wish to execute.
Furthermore, at the command prompt you can use F3 for the last command, and F8 repeatedly to go backwards through the history, one command at a time.
Finally, F2 allows you to copy a previous command up to the letter you enter.
I think these all come from the old DosKey program…
sShah said,
July 16, 2008 at 7:29 am
A simple DOSKEY /HISTORY would do the same, that is retrieving history of all typed command line. You can even pipe it to a, say text file; great for documentation. I know this because it helps me a lot when I need to prepare user manual for any application installation or that sort of stuff.. Cheerio