Command Prompt (CMD) is a widely popular and practical Windows command-line tool that can be used to deal with various works, such as CMD rename file, CMD ping test, CMD list files, CMD copy files, CMD list drives, CMD check WiFi password, and more.
However, a great many users and even professionals are unclear about these commands. For example, some users want to check the Command Prompt history in Windows 10/11 but don’t know how to do that. So, here we provide a full guide to list the CMD history in Command Prompt and PowerShell.
Can I View CMD History after Close
Unfortunately, you can only view the CMD history for current version. This is because the CMD history is not stored anywhere on Windows.
How to View CMD History in Command Prompt
How to check Command Prompt history Windows 10/11 in Command Prompt? There are 2 methods to view CMD history for currwent version. You can use the keyboard or the Doskey.
# 1. Check Windows CMD History Using the Keyboard
The first and simplest method is to use your keyboard with the Command Prompt. To do this work, follow the steps below:
Step 1. Press Win + R keys to open the Run dialog box, and then type cmd in it and hit Enter.
Step 2. In the Command Prompt window, press and hold the F7 key to view the history of Command Prompt. Then it will open the list of commands you currently typed in.
Step 3. With the command history Windows opened, you can run the command again using the up or down arrow keys. Also, you can press the Esc key to exit the Command Prompt window without running any command.
You can press Alt + F7 key to wipe the Windows Command Prompt history from the current session.
# 2. Check Windows CMD History Using the Doskey
The Doskey is another simple tool that can list the previously entered commands, edit command lines, and create macros. Here’s how to view Windows Command Prompt history using the Doskey.exe.
Step 1. Open the Command Prompt window again as we explained above.
Step 2. Type the following command and hit Enter. Then the command lines you recently executed will appear in the Command Prompt window.
doskey /history
Step 3. If you want to select and run the command, you can use the Up or Down arrow key and hit Enter. In addition, you can press the Page Down key to reenter the last command from the current session history or Page Up key to reenter the first command.
Windows will automatically clear the history of CMD logs and restart it for the new session once you restart your computer.
Step 4. If there are some useful commands that you may want to save for future use, you can run the following command to export the CMD history to a txt file. You can find the txt file in your WIndows Users folder.
doskey /HISTORY > history.txt
How to View CMD History in PowerShell
PowerShell can help you find the command history on Windows 10/11 as well. It’s very simple to view the PowerShell command history. Right click the Start menu from the bottom left screen and select Windows PowerShell. In the pop-up window, type the history command and hit Enter.
In addition, you can press Win + R keys to open the Run box, and then copy and paste the following command in it and hit Enter. It will direct you to a txt file that stores the command history of all sessions in PowerShell.
%userprofile%AppDataRoamingMicrosoftWindowsPowerShellPSReadline
Further reading: If you enter some issues like file system corruption and low disk space on Windows 10/11, don’t worry. MiniTool Partition Wizard can help you fix them easily by checking file system errors, extending/resizing partitions, analyzing disk space, upgrading to a larger hard disk, etc.