Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 10 down vote accepted

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

http://blogs.msdn.com/b/powershell/archive/2006/07/01/perserving-command-history-across-sessions.aspx

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
2  
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
2  
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
2  
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
1  
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
2  
Wow, Clink is fantastic. –  Chris Weber Jan 21 '13 at 16:06
1  
Clink is brilliant. Replaced cmd with it, been no problems, very happy with it. –  Colonel Panic Jul 24 '13 at 14:38
1  
Clink is amazing! –  Hoang Huynh Oct 24 at 4:39

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

share|improve this answer

Your Answer

 
discard

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.