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-06-23 22:24
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 【Original】Beyond the color command - Display colored text in CMD (valid for XP/Vista) View 18,529 Replies 70
Original Poster Posted 2007-05-04 19:19 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Long time no come to the forum to play, haha~~

Save the code as test.cmd under 2000/XP/2003/Vista and try double-clicking to run it~~


@echo off
chcp 437>nul&&graftabl 936>nul
ren %WinDir%\System32\config.nt config.nt.bak 2>nul
<"%~f0" more +6 >%WinDir%\System32\config.nt
command /cecho 









Reference posts:
1. (Closed) Who knows how to control the color of the string displayed by echo
2. Reprint: Use of ANSI.SYS program

Recommended website:
ASCII Art Software

Recommended software:
Yet Another Ansi Editor Download


---------------------The legendary divider line-----------------------
Included in TSCMD by Timo Salmi, heh
http://groups.google.com/group/alt.msdos.batch.nt/browse_frm/thread/6199e8abcd0c71db

Attachment: The version written by Timo Salmi: Perfectly backed up config.nt.

@echo off&&setlocal enableextensions
::
:: The paths
set ConfigNT=%WinDir%\System32\config.nt
set ConfigNTbak=%WinDir%\System32\config.nt.bak
::
:: Check that you have a backup or your original CONGIF.NT
if not exist "%ConfigNTbak%" (
echo.
echo Exiting %~f0
echo "%ConfigNTbak%"
echo File not found. Needed for restoring config.nt so first run
echo copy "%ConfigNT%" "%ConfigNTbak%"
goto :EOF
)
::
:: Use a copy of the backup as a double safety
copy "%ConfigNTbak%" "%temp%\CONFIG.NT">nul
::
:: Customize CONFIG.NT to use ANSI.SYS
> "%ConfigNT%" echo DOSONLY
>>"%ConfigNT%" echo dos=high, umb
>>"%ConfigNT%" echo device=%%SystemRoot%%\system32\himem.sys
>>"%ConfigNT%" echo files=40
>>"%ConfigNT%" echo DEVICE=%WinDir%\System32\ANSI.SYS /x
::
:: Choose the MS-DOS color
command /cecho 







[ Last edited by electronixtar on 2007-5-6 at 01:16 AM ]
Recent Ratings for This Post ( 7 in total) Click for details
RaterScoreTime
lxmxn +20 2007-05-04 19:25
baomaboy +4 2007-05-04 22:09
bjsh +20 2007-05-05 00:34
chenall +5 2007-05-05 13:07
zouzhxi +2 2007-05-09 15:16
0401 +4 2007-05-11 20:07
AlexZhang +12 2007-12-30 22:29
Attachments
1.JPG
YAAE.rar (323.96 KiB, Downloads: 829)

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 2 Posted 2007-05-04 19:25 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
electronixtar hasn't been here for a long time, and as soon as he comes, he brings something fun. Plus points.
Floor 3 Posted 2007-05-04 19:31 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Floor 4 Posted 2007-05-04 19:33 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Originally posted by slore at 2007-5-4 19:31:
No effect


Edited the code several times, let's try again~~

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 5 Posted 2007-05-04 20:23 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
What needs to be installed? The code is directly saved as a CMD file and runs only with pause
Floor 6 Posted 2007-05-04 20:29 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Originally posted by slore at 2007-5-4 20:23:
What do you need to install? The code is saved directly as a CMD file and only has pause when run.

It shouldn't be like that. XP comes with it by default.

Check your system32 directory

command.com

config.nt

Paste the content of config.nt here

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 7 Posted 2007-05-04 21:12 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
The file config.nt doesn't exist...
Floor 8 Posted 2007-05-04 21:52 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Hehe, it seems that you've been optimized out.

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 9 Posted 2007-05-04 22:11 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
Not bad, mine is available here. If there's no config.nt, try saving the following few lines of code.

DOSONLY
dos=high, umb
device=%SystemRoot%\system32\himem.sys
files=40
DEVICE=C:\WINDOWS\System32\ANSI.SYS /x
Floor 10 Posted 2007-05-04 22:19 ·  中国 广东 肇庆 四会市 电信
中级用户
★★
Credits 384
Posts 189
Joined 2005-10-19 13:12
20-year member
UID 43709
Gender Male
Status Offline
Haha, there's something new again...

electronixtar always brings us wonderful things...
Floor 11 Posted 2007-05-04 23:06 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Secretly tell everyone, Chinese ones can also be colorful

[ Last edited by electronixtar on 2007-5-5 at 12:49 AM ]

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 12 Posted 2007-05-05 09:17 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Alas, no effect.

I don't know what other problems there are... That file is there. I initially mistook it for WINDOWS; that one is in SYSTEM32.
Floor 13 Posted 2007-05-05 09:47 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Great stuff! Thanks for sharing!
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 14 Posted 2007-05-05 11:06 ·  中国 福建 厦门 电信
中级用户
★★
Credits 480
Posts 197
Joined 2006-09-20 00:40
19-year member
UID 63115
From 黄冈
Status Offline
Fun. . .
Floor 15 Posted 2007-05-05 11:27 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
Why can it only be displayed once??? The second time it runs, nothing is displayed at all!

config.nt
DOSONLY
dos=high, umb
device=%SystemRoot%\system32\himem.sys
files=40
DEVICE=C:\WINDOWS\System32\ANSI.SYS /x



[ Last edited by xycoordinate on 2007-5-5 at 11:35 AM ]
1 2 3 5 Next ›
Forum Jump: