Color Your DOS Command

Sometimes when running the batch script via DOS command window, using color output make help you analyze the result easily. Fortunately you can achieve this in Microsoft Windows 2000 and Windows XP

Syntax

Sets the default console foreground and background colors.

COLOR [attr][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 below 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. 

If only one digit is given, it will change the foreground color only.

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. 

Examples

Color 0A

转载于:https://www.cnblogs.com/Xiaojiang/archive/2008/03/31/1131505.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值