批处理之家's Archiver

Batcher 发表于 2008-9-16 15:15

[ZT]批处理超越color命令 - CMD里显示彩色文字

在2000/XP/2003/Vista下保存代码为 test.cmd 双击运行下试试~~[code]@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 electroniXtar
pause>nul&exit
DOSONLY
dos=high, umb
device=%SystemRoot%\system32\himem.sys
DEVICE==%SystemRoot%\System32\ANSI.SYS /x
files=40[/code]附:Timo Salmi 写的版本:完美备份了config.nt[code]@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 ANSI.SYS turn on
   ::
   :: Restore the original CONFIG.NT
   copy "%temp%\CONFIG.NT" "%WinDir%\System32\">nul
   if exist "%temp%\CONFIG.NT" del "%temp%\CONFIG.NT">nul
   endlocal & goto :EOF [/code]原帖地址:[url]http://www.cn-dos.net/forum/viewthread.php?tid=30382[/url]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.