cls - Clear Screen
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 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
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.
Hello World!
In the example above, the echo command displays the message Hello World!.
Next, the cls command is used to erase the previous output.
Hello World!

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

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

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

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門
The screen is cleared and the prompt is displayed again. The Microsoft copyright notice shown at startup is also erased.
Using cls in Batch Files
You can use cls in batch files to redraw the screen while the script is running.
Example:
@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.
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.
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
clsclears 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
pauseortimeoutso users can read a message before the screen changes - In PowerShell,
clsworks as an alias forClear-Host; on Linux, useclear