China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-13 15:41
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » How to set colors under DOS? View 1,965 Replies 9
Original Poster Posted 2006-10-22 05:15 ·  中国 广东 肇庆 端州区 电信
初级用户
Credits 112
Posts 49
Joined 2006-10-19 11:04
19-year member
UID 66890
Status Offline
In DOS, how can I set the foreground color and background color?
Floor 2 Posted 2006-10-22 05:22 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
COLOR /? can see the help information ~ : )


C:\>color /?
Sets the default console foreground and background colors.

COLOR

attr Specifies the color attributes of console output

The color attribute is specified by two hexadecimal digits -- the first
is the background, the second is the foreground. Each digit can be one
of the following values:

0 = black 8 = gray
1 = blue 9 = light blue
2 = green A = light green
3 = light green 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 parameters are given, the command resets the color to what it was
when CMD.EXE started. This value is either from the current console
window, the /T command line switch, or the DefaultColor registry value.

If COLOR is invoked with the same foreground and background colors, the
ERRORLEVEL is set to 1.

For example: "COLOR fc" produces bright red on bright white
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 3 Posted 2006-10-22 05:31 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
The color settings applications that are not purely DOS above,
If you still require a richly colored display when using pure DOS and also hope for special displays like "Paint"...
Please search for the keyword "ANSI" in the forum function "Search", there are more detailed tutorials and applications : )
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 4 Posted 2006-10-22 05:36 ·  中国 上海 黄浦区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
This is a DOS forum, so the first consideration is the DOS environment, not the cmd or command line environment. So what I oppose most is teaching Windows-related things right from the start
Floor 5 Posted 2006-10-22 05:42 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
What I oppose most is not teaching things under Windows, but answering without clearly seeing the owner's question

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 6 Posted 2006-10-22 06:10 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
The criticisms and reminders from DOSforever and electronixtar are correct~:)
I apologize for the previous failure to see the question clearly and the inappropriate response,
and I will definitely pay strict attention to and abide by it in the future~:)
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 7 Posted 2006-10-22 06:51 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline

  Too cruel, right    =_=

  Just a reminder is enough
Floor 8 Posted 2006-10-22 10:20 ·  中国 河南 许昌 长葛市 电信
新手上路
Credits 8
Posts 4
Joined 2006-10-22 09:43
19-year member
UID 67678
Gender Male
Status Offline
Thanks, bro. I learned here!
Floor 9 Posted 2006-10-22 12:42 ·  中国 广东 阳江 电信
初级用户
Credits 92
Posts 49
Joined 2006-10-22 12:22
19-year member
UID 67712
Gender Male
Status Offline
Floor 10 Posted 2006-10-29 04:37 ·  中国 广东 肇庆 电信
初级用户
Credits 112
Posts 49
Joined 2006-10-19 11:04
19-year member
UID 66890
Status Offline
Now I know that to set the foreground color and background color under DOS, you need to load the ANSI.SYS file. Who can provide a download for the ANSI.SYS file?
Forum Jump: