cls - Clear Screen

Maintained on

What is the cls Command?

The cls command stands for “Clear Screen” and is used to clear the screen in the command prompt. When you use this command, all currently displayed text is erased, and the prompt moves to the top left of the screen.

Clearing the screen can help you organize your workspace by removing past commands and outputs, making it easier to start new tasks.

Additionally, you can use the cls command within batch files or scripts to clear the screen during script execution.

Basic Usage of the cls Command

cls

This command has no arguments or options and works simply by typing it.

Examples of the cls Command

As an example, consider clearing the screen after performing some operations.

×
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 is used to display the message Hello World!. Next, the cls command is used to clear the previous command.

×
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副業超入門

This operation clears the screen and displays the prompt again. The initial Microsoft copyright information is also cleared, organizing the screen.

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

Using in Batch Files

You can use the cls command in batch files. This allows you to clear the screen during script execution.

例:

@echo off
setlocal
echo Processing...
cls
echo The screen has been cleared.
pause
endlocal

This script first displays a message, clears the screen with the cls command, and then displays a new message. When the batch file is executed, the initial “Processing…” message will not be visible by the time the pause command is reached.

For Linux Users

In a Linux environment, you can use the clear command to clear the screen.

Additionally, there is a shortcut key to clear the screen: pressing Ctrl + L will clear the screen.

Summary

The cls command in Command Prompt is a very simple yet highly useful tool. By clearing the screen, it helps to organize your work and avoid visual clutter.

#Command Prompt #Batch File #Arguments #Command Line #Command