One of the nice things of Linux is the command history – it stores typically the last 1000 commands or so and its saved every time you log out.
DOS does have this through the
doskey /history command (but only for current session) and you can relatively easily append this to a file:
The tricky bit is having this done for you on log out.
This only works for the current session though so you need to create a shortcut that runs the command each time with the following Target:
Then you just have to remember to type
exit each time…
I also found three useful commands – but they’re only for your current session. Hat tip to Nifty Computer Tricks:
- get last command
- current list (use left/right arrow keys to paste to the command line)
- auto-complete (type the first few letters)
Update 2 – Some extra love for the DOS prompt…
If you’ve got this working then I’ve added some extra basics. First you need to install Git (and I suggest you do it using the Chocolatey package). This includes the best versions of gnu commands compiled natively for Windows.
Add the Git usr bin directory to the path e.g.
Then download my !.bat / history.bat gist:
history.bat into the Git usr bin directory too. These assume you are saving the history to
Then you’ll be able to do commands like
history | grep mysql to list all your mysql commands in
history.log with their line numbers. Then call
! 123 to execute the specific line of the
Update 3 – Clink love
Martin Ridgers’ Clink is an awesome tool to behold. That adds the correct
! command to the DOS command prompt. Buuuuuuut… it doesn’t include a
history command. So save the above
history.bat file to
C:\Windows\System32\history.bat (it doesn’t have to rely on GNU Tools / Git) and uncomment