中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-10 04:30
47,811 topics / 349,897 posts / today 2 new / 48,255 members
DOS批处理 & 脚本技术(批处理室) » [Help] When using ANSI.SYS, how to set the background color of the CMD window?
Printable Version  2,557 / 17
Floor1 516526966 Posted 2008-10-05 11:58
初级用户 Posts 37 Credits 63
Found such code on the forum, very classic (displaying colored text in CMD).

But I don't understand how to set the overall background color.

The default foreground and background are black and white.

If I want the background to be green (color 2)

That is: change the black background in the picture to green? Image link address

How to set it? Please help everyone?


Floor2 516526966 Posted 2008-10-06 14:58
初级用户 Posts 37 Credits 63
Waiting online for everyone's help?????

Is there no expert willing to help?

[ Last edited by 516526966 on 2008-10-6 at 15:32 ]
Floor3 wxcute Posted 2008-10-06 17:15
中级用户 Posts 211 Credits 458
←[ is equivalent to the start符
m  is equivalent to the end符
;  is equivalent to the separator




It will have a background color if changed to something similar to the above. (I can't test here, you can try it)
Floor4 wxcute Posted 2008-10-06 17:21
中级用户 Posts 211 Credits 458
Also, your question should be revised. It shouldn't be about setting the window background color. If that's the case, just add a line at the beginning of the batch file like

color 21
and so on.
Floor5 516526966 Posted 2008-10-07 19:57
初级用户 Posts 37 Credits 63
Originally posted by wxcute at 2008-10-6 05:21 PM:
You should also modify your question. It shouldn't be about setting the window background color.
If that's the case, add a line at the beginning of the batch script like

color 21
or something like that.


Dude, I'm talking about setting the background color of the window,

Not the background color of the font,

I know that color sets the background and font.

But it always remains the default black-and-white interface.
Floor6 516526966 Posted 2008-10-08 02:47
初级用户 Posts 37 Credits 63
Request the help of the great experts?
Floor7 516526966 Posted 2008-10-08 20:40
初级用户 Posts 37 Credits 63
Great experts, please help me.

Please. The younger brother is waiting? Why no one pays attention to me
Floor8 516526966 Posted 2008-10-10 16:12
初级用户 Posts 37 Credits 63
Brothers, please help my younger brother. Waiting for a reply.
Floor9 516526966 Posted 2008-10-11 00:09
初级用户 Posts 37 Credits 63
Again, I ask for help. Or maybe some guidance is also okay. I didn't find relevant tutorials.
Floor10 516526966 Posted 2008-10-15 15:09
初级用户 Posts 37 Credits 63
Really discouraged. Is there really no one who knows? Or what reason is there for no one to reply.
Floor11 tireless Posted 2008-10-15 15:22
银牌会员 Posts 1,122 Credits 2,025
What is the difference between the background color of the window and the background color of the font?
Floor12 516526966 Posted 2008-10-15 15:42
初级用户 Posts 37 Credits 63


This is the difference
Floor13 wxcute Posted 2008-10-15 15:46
中级用户 Posts 211 Credits 458
Add color 2a under @echo off. As shown in the following figure:

Attachments
难道不是这样吗.gif (10.51 KiB)
Floor14 516526966 Posted 2008-10-16 01:20
初级用户 Posts 37 Credits 63
Originally posted by wxcute at 2008-10-15 03:46 PM:
Add color 2a under @echo off

As shown in the following figure:



Why can't mine work? I'm using Windows 2003

What testing environment are you using.
Floor15 516526966 Posted 2008-10-16 01:23
初级用户 Posts 37 Credits 63
Originally posted by 516526966 at 2008-10-16 01:20 AM:

Why can't mine work? I'm using Windows 2003.

What testing environment are you using?


Test results under Windows 2003

Why is mine like this.

[ Last edited by 516526966 on 2008-10-16 at 01:25 ]

Attachments
2008-10-16_010311.jpg (35.48 KiB)
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023