Complete Guide to Command Prompt Command History in Windows


The Command Prompt is referred to a black and white command line utility which always comes out of the box on Windows 10/8/7. But users who know very well about its actual potential, it’s the best replacement for many of the third-party software users. However, it can help you in managing your hard drive partitions, create a bootable USB drive for you, replace all the BIOS file, etc. Many power users and administrators are likely to use various commands on this command line to get their work done.

Below we will discuss some methods about how you can easily view, save, and clear Command Prompt command history in Windows and one other method to save that Command Prompt history on Windows 10 computer system.

Steps to View, Save, and Clear Command Prompt command History

Before starting the process, we will let you know that if you follow the given instruction in exact sequence, by doing this will protect your system from other damages. Below we will cover the following methods which will help you in fixing the issue; they are as follows:

  • View by DOSKEY
  • View by F7 Key
  • Save the Command Prompt History
  • Clear the Command Prompt History

Method-1: View Command History by DOSKEY

Using the DOSKEY to view Command history is one of the very simple or straightforward methods for all the users. After entering a series of commands in the Command Prompt window, you need to enter the following command inside the same Command Prompt window-

  • doskey /history

After this, now you will be able to check all the commands which you entered during that session in the Command Prompt in the same sequence you entered it.

Method-2: View CMD History by F7 key

However, this method is much better than the above given DOSKEY method. If you want to get back to any previously executed command, then surely this method is much reliable then some other methods. To view the Command history, you need to follow the below-given instruction:

  1. Press the F7 key on your keyboard. As F7 key always works for the Command Prompt and PowerShell too.
  2. This will direct to a small pop-up to appear with the list of all the previously implemented command in the session.
  3. You can make use of the up and down arrow located on your keyboard to go through the given list and after that, click on the Enter key to easily choose any one of them from the given list.

Method-3: Save the Command Prompt History

Many times, you might need to keep a record of the commands which is used in a session by easily using the Command Prompt in a TXT, HTML, CSV, or an RTF file.

  1. For that, make use of an extension of the DOSKEY command.
  2. Type the below-given command and press the Enter key,
  3. doskey /HISTORY > SampleHistory.txt
  4. After that, now the backed up history file will automatically be saved in a location where you can execute the command in the Command Prompt window.

Method-4: Clear Command Prompt History by Alt+F7

It is one of the easiest methods for clearing the Command Prompt History by ALT+F7.Though, the command history is cleared whenever you close it and again start the command prompt window.

To easily clear the command history, you can sue the ALT+F7 keys shortcut available on your keyboard. The Alt + F7 key always works for the PowerShell and Command Prompt.

  1. Moreover, you can be to delete the command history by using the Registry Editor. To delete it, type the below-mentioned key:
  2. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU
  3. Then, choose “RunMRU” and erase all the values which contain the name, a letter of the alphabet in the right pane of the window.
  4. After that, right-click on the “MRUList.”
  5. Next, click on the “Edit” option.
  6. Lastly, click on the “Delete” tab to delete the contents of Value data.

Sara is a Microsoft Office expert and her been working in the technical industry since 2002. As a technical expert, Sara has written technical blogs, manuals, white papers, and reviews for many websites such as office.com/setup.