Windows XP Tips, Tricks, Settings and more ...

MCSE Training Courses / Cisco Training Courses

Home/   Desktop/   Email/   Internet Explorer/   MSDos/   Networking/   Printer/   Registry/   
Training/   Windows 2000/   Windows 98/   Windows ME/   Windows NT 4.0/   Windows Vista/   Windows XP/

Change the DOS Prompt Color in a Batch File

In Category: MSDos

The COLOR command changes the colors of the DOS prompt text and (optional) background. COLOR takes a one or two-character argument. With one character, you can specify the text color. With two characters, the first character specifies the color of the background, and the second character the text color. The characters and colors are as follows:

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

For example, if your batch file needs to report an error condition, consider making the command prompt background red, and show the text in bright white. The following does the trick:


Note that you are not allowed to set the foreground and background colors the same. Trying to do so will cause the COLOR command to ignore your parameters. From within a batch file, the ERRORLEVEL will be set to 1.

To reset the colors to the default, just enter the COLOR command without any parameters.


FREE Learn English - Food
Speak English - Drinks
Windows Training

Top Articles:

Accounting Software Review
Dedicated Servers
Backup Software
Unix Training
Role of the Helpdesk
Distance Learning

Top Training:

Office 2010 Training
C# Training
Windows 7 Training
Sage Line 50 Training
A+ Training
CCNA Training

© 2007-2011 - RCS Limited. Terms & Conditions