System command

color command

Set the foreground and background colours of the command window.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

color [attr]

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Examples

Set the current window to a black background with bright green text.

color 0A

Parameters, options and clauses

color options and parameter descriptions
Option / clauseDescription
<attr>Use two hexadecimal digits: the first sets the background and the second the foreground.
No argumentRestore the colors from the current command window.
attrMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
/?Display command help or the supported command-line usage.
ValueMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
0Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
1Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
2Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
3Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
4Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
5Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
6Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
7Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
8Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
9Microsoft documents this argument or subcommand; check the linked reference for its required format and context.
aMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
bMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
cMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
dMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
eMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
fMicrosoft documents this argument or subcommand; check the linked reference for its required format and context.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory