The Command Prompt is nothing but a black and white command line utility that comes out of the box on Windows 10/8/7. But those who know its true potential, it is a great replacement for many of the users’ third-party software. For example, it can help you in organizing your hard drive partitions, create a bootable USB drive for you, refresh all the BIOS files, and much more. Many administrators and power users tend to make use of multiple commands on this command line to get their work done. Today, we will be talking about 2 methods that will help the user view their Command Prompt history and one method to save that Command Prompt history on Windows 10.
View, save, clear Command Prompt command History
We will cover the following topics:
- View using DOSKEY.
- View using the F7 key.
- Save the Command Prompt History.
- Clear command prompt history.
1] View command history using DOSKEY
This method is a pretty straightforward one. After you have entered a series of commands in the Command Prompt window, all you need to do is enter the following command inside the same Command Prompt window-
After that, you will be able to check all the commands that you just entered during that session in the Command Prompt in the same sequence as you entered it.
You can check a screen snippet of the same above.
2] View CMD history using the F7 key
This is better than the DOSKEY method mentioned above. I am not claiming that because this is better, but if you just want to get back to any previously executed command, it is really reliable.
To view the command history, you need to hit the F7 key. F7 works for Command Prompt and PowerShell as well.
This will lead to a small pop-up to appear with the list of all the previously executed commands in the session.
You can use the up and down arrow key to navigate through the list and hit the Enter key to select any of them.
2] Save the Command Prompt History
Sometimes, you might need to keep a record of the commands they used in a session using the Command Prompt in a TXT, HTML, CSV or a RTF file.
For that, you can use an extension of the DOSKEY command.
You just need to enter the following command and then hit the Enter key,
doskey /HISTORY > SampleHistory.txt
Then, your backed up history file will be saved in a location where you executed the command in the Command Prompt window.
4] Clear command prompt history using Alt+F7
The simplest way is to restart the Command Prompt. The command history is cleared automatically every time you close it and start the command prompt again.
To clear the command history, you can alsoe use Alt+F7 keyboard shortcut. Alt+F7 works for Command Prompt and PowerShell as well.
You can also delete the command history by using the Registry Editor. Navigate to the following key:
Next, select RunMRU and erase all the values having a name, a letter of the alphabet in the right pane. After this, right-click on MRUList > Edit, and delete the contents of Value data.
More Command Prompt tips & tricks here.
- Tags: CMD