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 23:59
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 【Original】Beyond the color command - Display colored text in CMD (valid for XP/Vista) View 18,539 Replies 70
Floor 16 Posted 2007-05-05 11:38 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Originally posted by xycoordinate at 2007-5-5 11:27:
Why can it only be displayed once??? The second time it runs, nothing is displayed!

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

It shouldn't be like that. lxmxn is also in such a situation~~Depressed oh

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 17 Posted 2007-05-05 11:44 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
I also only show once.....
Floor 18 Posted 2007-05-05 11:45 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
I am also in this situation. Could it be that Vista is not like this?
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 19 Posted 2007-05-05 12:00 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Floor 20 Posted 2007-05-05 12:18 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Now under Vista; running shows that the MS-DOS version does not match;

By the way
ren %WinDir%\System32\config.nt %WinDir%\System32\config.nt.bak

Because this syntax is wrong:
So all the machines that have run this batch processing have their config.nt all overwritten; and there is no backup of config.nt.bak;
This sentence should be changed to:
ren %WinDir%\System32\config.nt config.nt.bak

Just took a look, the content of config.nt in the original XP SP2 (excluding comments) is:
dos=high, umb
device=%SystemRoot%\system32\himem.sys
files=40

I don't know about Vista;

[ Last edited by bjsh on 2007-5-5 at 12:35 PM ]
Floor 21 Posted 2007-05-05 12:32 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Originally posted by bjsh at 2007-5-5 12:18:
Now under Vista; running shows that the MS-DOS version does not match;

I estimate the problem is here

ren %WinDir%\System32\config.nt %WinDir%\System32\config.nt.bak

Because this syntax is wrong:
So all...


Indeed wrong, I'll change it~~

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 22 Posted 2007-05-05 12:42 ·  中国 湖北 武汉 电信
初级用户
Credits 66
Posts 33
Joined 2007-04-28 11:32
19-year member
UID 86777
Gender Male
Status Offline
Not bad... accepted... try it out.......
Floor 23 Posted 2007-05-05 17:58 ·  中国 山西 运城 联通
初级用户
Credits 21
Posts 6
Joined 2007-02-05 07:36
19-year member
UID 78675
Gender Male
Status Offline
Not quite understand
DEVICE=%WinDir%\System32\ANSI.SYS /x
Why doesn't it use the same output method as other statements?
Why not use the %SystemRoot% variable instead of %WinDir%?

Moreover, if there is already a config.nt.bak, ren will cause an error when still renaming
But we can't see it
So it is suggested to restore before exiting
qzwqzw id for test
Floor 24 Posted 2007-05-06 15:06 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
19-year member
UID 59720
Status Offline
Haha, I modified the post of est. Keep the main part.
@echo off
chcp 437>nul
graftabl 936>nul
if not exist CONFIG.NT copy %WinDir%\System32\CONFIG.NT CONFIG.NT
@cls
echo DEVICE=%WinDir%\System32\ANSI.SYS /x >%WinDir%\System32\CONFIG.NT
command /cecho 
command /cecho We are going to change colors, do you want to change or not!
pause>nul
copy CONFIG.NT %WinDir%\System32\CONFIG.NT
del CONFIG.NT
exit
Floor 25 Posted 2007-05-06 15:32 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Posting images, posting images


@echo off & setlocal enableextensions enabledelayedexpansion
cls
set cecho_=command /cecho
for /l %%i in (0,1,7) do (
for /l %%j in (2,1,9) do (
set /a k=%%j-2
%cecho_% 








[ Last edited by electronixtar on 2007-5-6 at 06:34 PM ]
Attachments
1.jpg

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 26 Posted 2007-05-06 16:34 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Floor 27 Posted 2007-05-06 16:46 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Floor 28 Posted 2007-05-06 18:23 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
19-year member
UID 59720
Status Offline
Floor 25: Please post your code.
Floor 29 Posted 2007-05-08 15:51 ·  中国 安徽 芜湖 电信
中级用户
★★
Credits 247
Posts 123
Joined 2007-04-17 06:29
19-year member
UID 85468
Gender Male
Status Offline
It's really amazing, and beginners can't reach it.
Floor 30 Posted 2007-05-09 13:26 ·  中国 河南 郑州 联通
初级用户
Credits 91
Posts 45
Joined 2007-03-14 07:04
19-year member
UID 81689
Gender Male
Status Offline
Why can it only be displayed once, and when running again, there is nothing?
Forum Jump: