Please enable JavaScript to view this site.

Purpose:Clear the window and move the cursor to the upper left corner; optionally change the default display colors

 

Format:CLS [/= /C /S] [[BRIght] fg ON [BRIght] bg

 

fgThe new foreground color
bgThe new background color

 

 

Usage:

 

CLS can be used to clear the window without changing colors, or to clear the window and change the colors simultaneously, or to clear the entire scrollback buffer. These two examples show how to clear the window to the default colors, and to bright white letters on a blue background:

 

cls

cls bright white on blue

 

 

CLS also supports the COLOR / CMD.EXE hex color specification:

 

CLS bf

 

In this syntax, b is a hexadecimal digit that specifies the background color and f is a hexadecimal digit that specifies the foreground color.

 

A CLS with no arguments when ANSI is enabled will now use ANSI escape sequences to clear the screen and home the cursor. This should resolve a problem with unexpected fg / bg colors when you do a CLS and your ANSI colors do not match your StdColor and/or your default console color attribute.

 

See Colors and Color Names for details about colors.

 

Options:

 

/=Display the CLS command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/CClears the entire scrollback buffer. If /C is not used, only the visible portion of the window is cleared.

 

/SClear the screen by scrolling the buffer, rather than filling the screen with blanks (the default method ). This saves the text on the screen into the scrollback buffer if it is larger than the visible window. This switch may not give the expected results when the buffer size is less than twice the window size.