Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: MS DOS .: How to Change colors of the CMD window

How to Change colors of the CMD window

Sets the default console foreground and background colours.

Syntax
      COLOR [background][foreground]

Colour attributes are specified by 2 of the following hex digits. Each digit can be any of the following values:

0 = Black
8 = Gray

1 = Blue
9 = Light Blue

2 = Green
A = Light Green

3 = Aqua
B = Light Aqua

4 = Red
C = Light Red

5 = Purple
D = Light Purple

6 = Yellow
E = Light Yellow

7 = White
F = Bright White

If no argument is given, COLOR restores the colour to what it was when CMD.EXE started.

Colour values are assigned in the following 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:


COLOR 07, white on black is the default.

"COLOR 00" is an invalid option and will set %ERRORLEVEL% to 1 (this fails on some early builds of NT 4 - see verify for an alternative method of raising an error)

The COLOR command will change the color of all the text in the window, to change individual lines or words you need to use PowerShell (Vista or Win XP) like this: Write-Host -ForeGroundColor Red "some text in red" -nonewline


How helpful was this article to you?

Related Articles

article How to Connect to Terminal Services with a Color Resolution of Greater Than 256 Colors in the Server 2003 Family
SUMMARY This step-by-step article shows...

(No rating)  7-3-2008    Views: 87   
article How to Change Terminal Server Session properties using CHANGE command
Change Terminal Server Session properties....

(No rating)  3-7-2008    Views: 248   
article How to change the MAC address in W2K and XP
Method 1: This is depending on the type...

(No rating)  7-6-2008    Views: 106   

User Comments

Add Comment
No comments have been posted.