By default, when you open a command prompt window on a Microsoft Windows system, you get a window with a black background and white text. If those color choices are not the ones you would prefer, you can change them with the
color
command.C:\Windows\system32>color /? Sets the default console foreground and background colors. COLOR [attr] attr Specifies color attribute of console output Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. 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, this command restores the color to what it was when CMD.EXE started. This value either comes from the current console window, the /T command line switch or from the DefaultColor registry value. The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background color that are the same. Example: "COLOR fc" produces light red on bright white C:\Windows\system32>
If you would prefer black text on a white background, you can use
color 70
, though the background color looks like a light
gray on the systems on which I've tried that color combination, rather than
white.
The command color f0
, which is for black on bright white,
does provide a white background with black text, though, on those same
systems.
If you don't like a color combination you've obtained from the command,
you can set the colors back to the default white text on a black background
by entering the color
command with no options.
If you want to make the change apply to every command prompt window
you open for the currently logged on account, you can use the windows
regedit
command to edit the registry key
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
and change
the value for DefaultColor
from its default value of 0 to the
hexadecimal value f0
, which is decimal 240
.
Once you've changed the registry value, every new command prompt window you open from that time onwards will use the new settings.
You can check on the registry value from a command prompt with the
command reg query "HKEY_CURRENT_USER\Software\Microsoft\Command
Processor" /v DefaultColor
.
C:\Users\User>reg query "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DefaultColor HKEY_CURRENT_USER\Software\Microsoft\Command Processor DefaultColor REG_DWORD 0x0
You can set the value from the command prompt with a command similar to the following one:
C:\Users\User>reg add "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" / v DefaultColor /t REG_DWORD /d 240 /f The operation completed successfully. C:\Users\User>
The data to be used is specified with the /d
option. In the
above case, I am using the decimal equivalent, 240, to the hexadecimal number
F0 and adding the /f
option, so that I won't be prompted
as to whether I wish to overwrite the existing value.