Changing the Background and Foreground Colors

Posted: May 1, 2010 in Logon Script with Shell
Tags:


Windows 2000/XP/2003 supports the color command to change the background and foreground in a shell prompt. The basic syntax of the color command is as follows:

COLOR BF

Here, B is the background color value and F is the foreground color value. The color command supports the following color 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

Here is an example to change the shell prompt colors to bright white text on a blue background:

IF “%OS%”= =”Windows_NT” COLOR 1F

Here, %OS% is an environment variable that indicates the operating system type.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s