Register Login

How to Clear Command Prompt Screen Windows?

Updated Feb 10, 2023

Windows Command Prompt (cmd.exe) lets us quickly open applications, execute tasks, troubleshoot some Windows issues, etc. by typing command lines. After working with the command prompt for a while in a single session, the command prompt window can become cluttered, so it is important to know how to clear the screen.

In this article, we will learn quick ways to Clear Command Prompt in Windows

Clear Command Prompt with CLS Command

This method is the most genuine and easiest method to clear the Command prompt you just need to type "cls" on the command prompt and your screen will be clear. Please follow the steps below:

Open the Windows Search Bar, type Command Prompt, and click on Open

Open Command Prompt

Enter multiple standard commands into the blank cmd screen.

Next type CLS and press Enter button. This will clear all the previously entered commands from the CMD screen in Windows.

Cls command to clear cmd screen

Keyboard Shortcut to Clear Command Prompt Screen

There are no keyboard shortcuts to clear the screen in command Prompt, but you cal press ESC to clear the input line and Cntrl + C to move the cursor to the new blank line.

But If you really want to clear CMD with a keyboard shortcut then you have to use the AutoHotkey and write the following script that sends cls<Enter> to the open command prompt window.
 

; -------------------------------------------------------------------------
; Keyboard Shortcut Cntr + L should clear CMD screen
; -------------------------------------------------------------------------
#IfWinActive ahk_class ConsoleWindowClass
^L::
Send cls{Enter}
return

#IfWinActive

Working of Script

  • First, the script will check if one is within a console application
  • And if CTRL+L is pressed
  • Write cls to the console and then hit ENTER

How to View CMD Commands History?

Open the command prompt and type doskey /history command line, and hit Enter. This will display all the commands you previously entered in the same sequence.

Run doskey/history

View Command History

Alternatively, you can also press Press F7 to see all previously entered commands.

Press F7 to view command history

How to Save Command Prompt History?

Sometimes you may need to save your history of command you typed in a Command Prompt window for the future. For this just need to type command doskey /history > filename.txt and press Enter.

For example:

doskey /history > D:\python\commands.txt

Save Command History

Next, you can save the Commands history in a TXT, HTML, CSV, RTF file.

Alternatively, you can also run the doskey /history command, and then copy & paste command history to another application and save it.

Conclusion

There is one method to clear the command prompt screen in Windows and i.e. run cls command, but if you are bounded to use keyword shortcut to clear the cmd screen then you have to write a custom script using AutoHotKey as explained above in the article.

Hope this article be helpful for you.


×