How to clear the screen
Overview
cls clears visible text from the Command Prompt window and places a fresh prompt at the top.
It changes only the display. It does not delete files, undo commands, reset variables, or erase the session's command history.
- Run a noisy command such as
dir, then entercls. - Use the Up Arrow after clearing to prove earlier commands are still available.
doskey /historyprints commands used in the current window.
Commands to try
Type each command at the prompt, then press Enter. Replace sample names and paths with ones that exist on your computer.
Commands are generally not case-sensitive, but preserving the spelling shown here makes scripts easier to read.
dir
cls
doskey /history
Useful options and details
Options change how a command behaves. Add spaces exactly as shown, and use the command's built-in help when an option is unfamiliar.
A path containing spaces must be enclosed in double quotes, such as "C:\My Files".
clstakes no commonly needed options.- Ctrl+L is not a dependable CMD shortcut; use
cls. - Closing the window ends that CMD session, unlike clearing it.
Tips and common mistakes
Check the current folder and read the command output before assuming an operation succeeded.
Practice with disposable files first. Commands that delete, overwrite, or stop a process may not offer an Undo button.
- Do not expect
clsto cancel a running command; try Ctrl+C carefully instead. - Redirected output written to a file remains in that file.
- Clear the screen before screenshots so private paths or output are not visible.
Safe practice
Create a temporary practice folder under your user profile so the examples cannot affect Windows system files.
After each command, inspect the result with dir or another read-only command before continuing.
- Run
ver,dir, andcls. - Press Up Arrow twice and observe the recalled commands.
- Display history with
doskey /history.