标题: [ZT]批处理超越color命令 - CMD里显示彩色文字 [打印本页]
作者: Batcher 时间: 2008-9-16 15:15 标题: [ZT]批处理超越color命令 - CMD里显示彩色文字
在2000/XP/2003/Vista下保存代码为 test.cmd 双击运行下试试~~- @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 [1;31mele[32mct[33mroni[35mX[36mtar[m
- pause>nul&exit
- DOSONLY
- dos=high, umb
- device=%SystemRoot%\system32\himem.sys
- DEVICE==%SystemRoot%\System32\ANSI.SYS /x
- files=40
复制代码
附:Timo Salmi 写的版本:完美备份了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 [0;40;31;1mANSI.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
复制代码
原帖地址:http://www.cn-dos.net/forum/viewthread.php?tid=30382
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |