How To Clear Command Prompt?

0 rating based on 0 reviews

A Command Prompt window is one of the most successful ways to run a batch file or perform an application. It has a lot of helpful features such as cleaning up text and copying the output on your screen. But, what if we want to clear the current Command Prompt window? In this article, we are going to look at two different ways to do this.

Clear Command Prompt

The command prompt, aka cmd.exe or CMD, is one of the essential tools in Windows. CMD helps to execute many tasks that are useful when the computer is having problems. CMD can also be used to know different hardware information and configuration and change many settings easily.

However, there are tons of commands for the command prompt and typing a wrong command by mistake requires the file to be cleared. The CMD may also need to be removed in case there are too many lines. For this reason, today, I will talk about how to clear the command prompt in windows.

Clearing the Entire Command Prompt

If you wish to clear the entire command prompt:

  1. Launch the command prompt.
    a).  Hold the “Windows” button and press “R” on the keyboard to open “Run” and enter cmd.
    b).  Use the search tool to search for the command prompt and then open it.
    Search for the command prompt
  2. Type any command on the command prompt (i.e. ipconfig).
  3. Now, to clear the screen, type “cls” and hit enter.command for clearing command prompt

The command prompt will be cleared completely. If you want, you can close the command prompt and reopen it, and a blank command prompt will open as if it was removed.

Clearing a Line in the Command Prompt

If you don’t want to clear the entire command prompt but only a line, then do this:

  1. Type a line on the prompt.
  2. Before hitting “Enter” on the keyboard, press “Esc.”
  3. This will clear the entire line.
  4. To clear a few letters in the line, press the “Backspace” button.
  5. To clear a word at once, hold the “Ctrl” button and then press “Backspace.”

If you want to jump to another line without clearing the current line, hold “Ctrl” and press “C” on the keyboard.

Jumping to a new line before entering a command

Note: If you already press “Enter” after typing a command, you won’t be able to clear a line. In this case, you have to remove the entire command prompt.

Viewing and Saving History of Command Prompt

After clearing the command prompt, if you wish to view which commands you have already entered, you should do the following:

  1. Go to a new line in the command prompt.
  2. Type “doskey/history” and hit “Enter.”Using the doskey/history command
  3. This will show you all the commands you have previously entered.
  4. Alternatively, you can press “f7” on your keyboard. It will open a new window and show all the previously entered commands.Pressing the f7

Here, you can choose any command using the “Up/Down” arrow keys, and then if you press “Enter,” the command will run again in the command prompt.

Note: You can view the history before clearing the command prompt or removing it using the “cls” command. But if you close the prompt and then reopen it, it will not show you the command history of the previously opened command prompt.

In this case, you can save the history before exiting the command prompt. To do that:

  1. Jump to a new command line.
  2. Enter “doskey /HISTORY > filename.txt” this command.

It will save the history as a text file in your user folder. You can give any name to the file instead of “filename.” You can also use “.html” “.csv” or “.rtf” instead of “.txt” to save the file as an HTML, CSV, or RTF file.

Summary: Clear Command Prompt

  • Clear Command Prompt.
  • Right click on it to open the menu.
  • Mark the edit text.
  • Check the options Emulation, Set Font, Screen Buffer Size and Window Position In the menu.
  • Select Apply and OK.
  • Afterwards the text in your command prompt will be clearer.