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:
- 0 Black
- 1 Blue
- 2 Green
- 3 Aqua
- 4 Red
- 5 Purple
- 6 Yellow
- 7 White
- 8 Gray
- 9 Light Blue
- A Light Green
- B Light Aqua
- C Light Red
- D Light Purple
- E Light Yellow
- F Bright White
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 DefaultColor registry value.
- The CMD /T
command-line switch.
- The current colour settings when cmd was
launched.
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
- 1 Attempt to set foreground and background to same colour
Availability
- External
-
- DOS
-
none
- Windows
-
none
- Windows NT
-
NT4
NT2000
NTXP
NT2003
Last Updated: 2003/07/28
Direct corrections or suggestions to:
Rick Lively