Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to keep the cmd command history between sessions?

share|improve this question
up vote 18 down vote accepted

Switch to using PowerShell, and follow the instructions at the following site to enable history:

Alternatively, in cmd.exe, you can use "doskey /history" at the end of your session to show what you typed in that session, but theres no way to really load it into the next session.

share|improve this answer
I hestitated to +1 this because "Switch to using PowerShell" is not necessarily as easy as it sounds depending on what sort of stuff you're using the console for, but the info is accurate soooooooooo ;) – Shinrai Mar 15 '11 at 14:23
Agreed. I hesitated to put it down but it's the only real answer I can find. I tried to get something similar going on a workstation I had before, but there just isn't a persistent history mechanism available for cmd.exe :-( – Hyppy Mar 15 '11 at 14:27
Note that this will keep a list of commands you typed, but it doe NOT alter the list of commands that will come up when you hit the up key on the keyboard. It doesn't affect the "doskey" functionality, in other words. – Mark Apr 13 '11 at 19:06

I've found 2 ways, neither of which require switching to PowerShell.

  1. Install Clink, which enhances cmd.exe with persistent history and much more. Just install it and then open cmd as normal.

  2. Install TCC/LE free version, which is a separate program, again providing an enhanced version of cmd.exe.

share|improve this answer
I am a bit apprehensive against system-wide replacing of cmd.exe but its a good answer, and clink supports an injection mode as well. – Lo Sauer Sep 9 '12 at 18:10
If you don't want to install it system wide, you can launch it via a shortcut to clink.bat. – William Bettridge-Radford Nov 13 '12 at 12:53
Wow, Clink is fantastic. – Chris Weber Jan 21 '13 at 16:06
Clink is brilliant. Replaced cmd with it, been no problems, very happy with it. – Colonel Panic Jul 24 '13 at 14:38
Clink is amazing! – Hoang Huynh Oct 24 '14 at 4:39

I use cygwin. It also provides some others functionalities that Linux has but Windows not.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.