Helping millions of people navigate the world of technology.

How to View Command Prompt (CMD) History on Windows

Quick Tips
  • Hold the F7 key or hold the ‘Fn’ key with F7 to access the history of your commands.
  • You can also use the doskey /history command to view the history of your CMD session.
  • Command Prompt also allows you to export the history of commands executed in a session onto a text file.

Method 1: Use a Keyboard Shortcut

There is a keyboard shortcut to view the history on CMD quickly. You can hold the F7 key or hold the ‘Fn’ key with F7 to access the history of your commands. It will appear in the form of a dialog box.

You can use the up and down arrow keys to navigate through your commands. Hit the enter key to execute the highlighted command.

Command Prompt History from Shortcut

Method 2: Use a Command to Access the CMD History

Alternatively, you can use a command to view the history of your CMD session. After executing a series of commands in your session, use the command below and hit the enter key to access your history.

doskey /history
Check History using Command

If there are many commands in your history, it is much more convenient to export them to a text file – more on that as we move on to the next section of the article.

How to Export the Command Prompt History to a Text File

Command Prompt also allows you to export the history of commands executed in a session onto a text file. You can also specify the desired destination to save the text file.

Step 1: Once you access the history, type cd to change the directory, and enter the folder path you want to save the text file. Enter the following command below and hit enter.

cd "filepath"

Ensure that you enter the path in double quotes. To find the path of a folder, right-click on the folder, and select ‘Copy as Path’.

Step 2: Then enter the following command.

/HISTORY > history.text
Export History

Step 2: There you go. You can now open the folder where you saved the history and access the ‘history.text’ file.

History Text File

How to Increase Command Prompt History Size

You can increase the size of the command history page by adjusting the properties of the Command Prompt window.

By default, Command Prompt stores a limited number of previously entered commands in its history. The default size is set to 50 commands.

Open a CMD window and enter the following command.

doskey /listsize=150

We’ve changed the size from 50 to 150. You can enter any desired value to increase the history.

Increase History Size

Also Read: How to create a folder or file from Command Prompt.

Was this helpful?

Thanks for your feedback!

Last updated on 11 July, 2024

1 Comment

  1. useful.
    it would be nice to automatically have the command history in a new cmd window also.
    Also after a reboot.
    Is this possible?

    one note: you missed the command “doskey” in Step 2. In the screenshot it is ok.

Leave a Reply

Your email address will not be published. Required fields are marked *

The article above may contain affiliate links which help support Guiding Tech. The content remains unbiased and authentic and will never affect our editorial integrity.