If you are a long time user of Windows, you must be knowing about the Command Prompt. Command Prompt is basically a command line interpreter present on Windows also known as CMD or cmd.exe. Now, you might not need to use the Command Prompt window in your PC. However, there are Windows users out there who have to work on Command Prompt window, day in and day out. For them, it is a hassle to keep typing one command again and again. Therefore, we are now going to tell you about the Command History feature of Command Prompt on Windows 10.
The command history of Command Prompt is a history of all the commands we have typed in a particular session. Most of the users currently see their recent commands in Command Prompt by manually clicking the Arrow keys up and down. However, there is now a much easier way to view this command history and even export all those commands to an external text file. So, read along to know how to use this command history feature and make your life much easier while using Command Prompt
How to use the command history feature of Command Prompt on Windows 10
- Press the Start button on your keyboard
- Type “Command” inside the search bar and click on the Command Prompt application
- Press the F7 key on your keyboard once the Command Prompt window opens. You will see a command history window same as the one highlighted below
- Another way to open command history window is by typing a command in Command Prompt. If the F7 key method doesn’t work for some reason, type the following command inside your Command Prompt window:
- You will get the command history inside your Command Prompt window as an output. You can see the result from the screenshot attached below
- You can also export the command history to an external text file. For this, just type the command same as below and your command history will be exported
doskey /h > C:\cmd_history.txt
- The above command will create a new text file named cmd_history.txt on your PC and write the command history to it. This file can be accessed from “C:\cmd_history.txt”. We have attached a screenshot of the sample text file of our exported command history for reference
- That’s it. You have just viewed your command history and exported the command history into an external text file as well.
In case you have doubts regarding this tutorial, feel free to comment below with your questions. We will make sure to solve them in the best way possible.