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


/C(lear buffer)/S(croll buffer)




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 bright white on blue


CLS is often used in batch files before displaying text.


See Colors and Color Names for details about colors.




/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.