Skip to main content

Command referencecls

cls command (Windows / CMD)

WindowsCMDotherbeginner

What it does

Clear visible text from the Command Prompt screen. Searches for the cls command cmd clear screen usually need CMD syntax, practical switches, and notes on how it compares with PowerShell or Linux alternatives. This page covers syntax, common options, and copyable examples for Command Prompt.

Clear visible text from the Command Prompt screen.

Syntax

cls

Common options

Flag / optionMeaning
clsClear the current console buffer view.
& clsClear after another command on the same line.
echo text & clsDemonstrate CMD command chaining.

Practical examples

Clear screen

cls

Clears the visible Command Prompt window.

Clear after pause

pause & cls

Waits for a key, then clears.

Batch refresh

:refresh
cls
echo Status updated

Clears before redrawing batch status.

Common mistakes

  • Expecting cls to erase command history.
  • Using cls to hide sensitive output that remains in logs or captured buffers.

FAQ

What does cls do in Command Prompt?

Clear visible text from the Command Prompt screen.

How do I run cls in CMD?

Open Command Prompt and follow `cls`; quote paths containing spaces.

What is a practical cls example in CMD?

Try `cls` — Clears the visible Command Prompt window.

Can cls be used in a batch file?

Yes. Check its exit code and escape CMD metacharacters when input is variable.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.