How To View Command History In Windows 10?

Summary: The Command Prompt (cmd) is one of the most helpful tools on any Windows computer. Although Microsoft has released more tools, such as PowerShell and Windows Terminal, most users still prefer to use the command prompt to perform everyday command-line tasks. Although many users know that they can use commands such as SFC and CHKDSK in cmd, few users know how to view the command history in Command Prompt. In this article, we will teach you the methods to view command history in Command Prompt.

The Command Prompt program enables users to run programs, batch files, automate tasks, and even perform administrative functions along with troubleshooting issues on Windows 10. The use of cmd is also often recommended in fixing methods when facing computer and disk failures, such as the SFC command and the CHKDSK command. For users who usually use the Command Prompt, the command history feature is a plus as you can cycle between previously used commands and even log them as a .txt file in an active session.

However, the history cannot be restored if you exit Command Prompt as this feature works for the current working session only. This means that if the Command Prompt window is closed or if the PC restarts then the history is wiped out. So if you want to view the command history, please read the following methods below.

2 Methods to View Command History in Command Prompt

Method 1:View Command History With Keyboard Shortcut

If you’re in a time crunch, you can trust your keyboard to help your check Command Prompt history for the current session. Besides, it is noticed that you can only view the history if you run cmd as an administrator.

  1. Select Run as an administrator to open Command Prompt, and execute some commands.
  2. In the Command Prompt window, hold the F7 key to open the list of commands you’ve run recently.
  3. Scan the list and press the one you want to execute again.
  4. Click on Enter.

You can also search for a specific command from your CMD history. To search for a specific command from the history, just press the F8 key, type whatever you remember and then press the F8 key to cycle through the possibilities from the history.

For example, if the command I’m searching for starts with ip, I will type ip and then press the F8 key. Pressing the F8 key again will bring another possible result from history if any. Keep pressing the F8 key again and again until the history list ends.

Method 2: Using Doskey to View Command History

In the Command Prompt window, type in the command: doskey /history and press Enter.

This would list down all of the previously executed commands in that session on Command Prompt.doskey history

Method to Save Command History in a .txt File

As mentioned, the command history in Command Prompt on Windows 10 only works for the current session and you cannot access the history after you restart the computer. But you can save the command history as a TXT, HTML, CSV or RTF file before closing the window so that you can have a backup of your entered commands.

  1. Type cmd in the search bar. Right-click on the Command Prompt app and select Run as Administrator to proceed.
  2. Type the command: doskey /h > c:\cmd_history.txt and press Enter. This would log your command history from Command Prompt in a .txt file on your C drive.cmd-save command history
  3. Press Win + E to open File Explorer, and you will find a text document named cmd_history in C drive.txt-cmd_history
  4. Click on it to open the file and view the history of all your previously executed commands logged in this file.

FAQ about Command Prompt

What’s the difference between Terminal and Command Prompt?

Both programs are command-line shells that can troubleshoot errors and manage system maintenance. However, the Command Prompt is more user-friendly and suitable for day-to-day tasks. On the other hand, Terminal has more advanced functions and allows users to run several tasks or work on multiple projects simultaneously.

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 20

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Related articles



Please enter your comment!
Please enter your name here

Share article

Latest articles

Popular articles