COLOR – DOS Command

It sets the default console background and foreground colors.
Commands can be run using Microsoft Windows XP Command Prompt (cmd.exe)

To view ‘color’ command with its all possible parameters you can use following command. Its like help information to regarding that command.


Syntax :

	COLOR [attr]


attr: It specifies color attributes of console output.
Color Attributes / Codes:

Color attributes are specified by 2(TWO) hex digits, the first corresponds to the background; the second the foreground. Each digit can be any of the following 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

‘color’ command sets ERRORLEVEL=1 if an attempt is made to execute the ‘color’ command with a foreground and background color that are same.

Use 1:

– ‘color’ command with no arguments restores the color what it was when CMD.exe started.

Use 2:

color 2
– ‘color’ command with 2 as argument sets foreground color as Green and by default Black as a background color.

Use 3:

color 3
– ‘color 3’ command sets foreground color as Aqua and by default Black as a background color.

Use 4:

color 4E
– When, you use ‘color 4E’ then it sets Red as a background color and Light Yellow as a foreground color.

Output :

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\DINESH > color 4E_

Using Color Command in DOS :

Fig.: Using Color Command in DOS

Leave A Comment

Your email address will not be published. Required fields are marked *