Home > Commands A-M > Commands Ch-Cz

COLOR


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Sets the default console foreground and background colours.


Syntax

COLOR /?

COLOR [background_attr][foreground_attr]

Restores the colour to what it was when CMD.EXE started:

COLOR


Parameters
background_attr (NT4)
foreground_attr (NT4)
Specifies colour attribute of console output.
Colour attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. Each digit can be any of the values:

Switches
/? (NTXP)
Display help.

Related

CMD - Start a new CMD shell
VERIFY?
Equivalent Linux BASH commands:
dircolors - Colour setup for `ls'


Notes

Colour values are assigned in the order:

The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background colour that are the same.


Examples

White on blue:

    COLOR 17

Red on blue, use for error conditions:

    COLOR 1c

"Wordperfect style" white on light blue:

    COLOR 97

High contrast yellow on light blue:

    COLOR 9e

White on black, the default:

    COLOR 07

Invalid, will set %ERRORLEVEL% to 1 (fails on some early builds of NT 4).

    COLOR 00

Errorlevels
Availability
External
DOS
none
Windows
none
Windows NT
NT4 NT2000 NTXP NT2003

Last Updated: 2003/07/28
Direct corrections or suggestions to: Rick Lively