Command Prompt is widely used by almost every user to run various commands. Some commands are used commonly and repeated again and again for any purpose. If you forget about which command you just run because you need hat command again to run. Do not get worried because you can go to the history of the Command Prompt window and easily view command prompt history.
In this tutorial, I am providing you the ways to see the list of your commands which you run recently. And you can also save that list for your easiness so if you ever forget any command, just go to the saved file of commands and get your required command.
View Command Prompt History Using F7 Key
The Command Prompt window will show you history for only the current session. If you close the Command prompt window, and on the next opening of CMD, all the previous commands will be gone.
Now open Command Prompt window, and start executing your commands. Suddenly you need the previous command you just wrote, but it just skipped from your mind.
For this, pressF7 key, and a pop-up window will appear to give you a list of all recently executed commands. Use Up and Down arrow to navigate towards your required command
And after reaching to it, press Enter key. And here you are. Your command is executed.
View Command Prompt History Using Doskey
To have the entire list of your Command Prompt window’s commands, on the window as a text, you have to type the following command in your CMD window.
Because sometimes, you do not like pop-up windows all the time. That’s why I am giving you an easy and clean way to see the history of your Command Prompt window.
Open CMD from the Start Menu and type “doskey /History”. As you typed, all the commands which you typed latterly are shown to you on your CMD window.
Use Up and Down arrow to select the command. Or you can also Copy and Paste the commands from the history which has appeared on your screen, within the window of CMD.
Saving Command Prompt History
You can only view the history of commands as long as your CMD window stays open. When you close it, all commands will be gone with no mark of history. What if you need the same commands for the next use of CMD window, but you do not know that which commands you executed before.
You can save your commands list as a TXT, HTML, CSV or RTF file before closing the window so that you can have a backup of your entered commands.
Type the following command in your Command Prompt window
doskey /HISTORY > history.txt
Your file will be saved in the Users folder. Now go to users folder and see that has file saved there or not.
See your history of all commands and save them in a notepad file to use any of your commands anytime if you need. I hope you have a clear understanding of how to view your history in CMD and how to save that history. If you have any question, comment below to ask.