cls - Clear Screen

Maintained on

cls is a basic command for tidying up the Command Prompt display.

What is the cls Command?

The cls command stands for “Clear Screen” and clears the Command Prompt screen. All currently displayed text is erased, and the prompt moves to the top left of the screen.

Clearing the screen removes past commands and output, which helps you start new work with a clean display.

You can also use cls inside batch files and scripts to clear the screen while the script is running.

cls only changes what is displayed

cls erases the screen, but it does not change the current directory, environment variables, or file contents. It only tidies up the display.

Basic Usage of the cls Command

Basic_usage_of_the_cls_command
cls

This command has no arguments or options. Just type it and press Enter.

In PowerShell, cls also clears the screen. It is an alias for the Clear-Host cmdlet.

Example of the cls Command

As an example, consider clearing the screen after running some commands.

- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>echo Hello World!

Hello World!

C:\users\user>

In the example above, the echo command displays the message Hello World!. Next, the cls command is used to erase the previous output.

- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>echo Hello World!

Hello World!

C:\users\user> cls
おすすめ書籍※ 広告を含む場合があります
中小企業経営者のためのRPA入門 RPA導入を成功させる方法

中小企業経営者のためのRPA入門 RPA導入を成功させる方法

60分でわかる! AIエージェント 超入門

60分でわかる! AIエージェント 超入門

コマンドラインの黒い画面が怖いんです。

コマンドラインの黒い画面が怖いんです。

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

The screen is cleared and the prompt is displayed again. The Microsoft copyright notice shown at startup is also erased.

- □ ×
Command Prompt Icon
Command Prompt
C:\users\user>

Using cls in Batch Files

You can use cls in batch files to redraw the screen while the script is running.

Example:

action-with-cls.bat
@echo off
setlocal
echo Showing the first message.
pause
cls
echo This is the next screen.
pause
endlocal

This script displays the first message and pauses, clears the screen with cls, and then displays the next message. This pattern is common in menu-style batch files and scripts that switch screens step by step.

A message shown right before cls disappears instantly

cls clears the screen the moment it runs. If you want users to read the previous message, wait for input with pause, or wait a few seconds with something like timeout /t 3 before running cls.

For Linux Users

On Linux, use the clear command to clear the screen.

Many terminals also support Ctrl + L. Note that Ctrl + L does not work in Command Prompt (cmd.exe), so type cls instead.

Summary

  • cls clears the Command Prompt display and has no arguments or options
  • Only the display is cleared; the current directory and environment variables are unchanged
  • In batch files, combine it with pause or timeout so users can read a message before the screen changes
  • In PowerShell, cls works as an alias for Clear-Host; on Linux, use clear
#Command Prompt #Batch File #Command