Board logo

标题: [ZT]批处理超越color命令 - CMD里显示彩色文字 [打印本页]

作者: Batcher    时间: 2008-9-16 15:15     标题: [ZT]批处理超越color命令 - CMD里显示彩色文字

在2000/XP/2003/Vista下保存代码为 test.cmd 双击运行下试试~~
  1. @echo off
  2. chcp 437>nul&&graftabl 936>nul
  3. ren %WinDir%\System32\config.nt config.nt.bak 2>nul
  4. <"%~f0" more +6 >%WinDir%\System32\config.nt
  5. command /cecho electroniXtar
  6. pause>nul&exit
  7. DOSONLY
  8. dos=high, umb
  9. device=%SystemRoot%\system32\himem.sys
  10. DEVICE==%SystemRoot%\System32\ANSI.SYS /x
  11. files=40
复制代码
附:Timo Salmi 写的版本:完美备份了config.nt
  1. @echo off&&setlocal enableextensions
  2. ::
  3. :: The paths
  4. set ConfigNT=%WinDir%\System32\config.nt
  5. set ConfigNTbak=%WinDir%\System32\config.nt.bak
  6. ::
  7. :: Check that you have a backup or your original CONGIF.NT
  8. if not exist "%ConfigNTbak%" (
  9. echo.
  10. echo Exiting %~f0
  11. echo "%ConfigNTbak%"
  12. echo File not found. Needed for restoring config.nt so first run
  13. echo copy "%ConfigNT%" "%ConfigNTbak%"
  14. goto :EOF
  15. )
  16. ::
  17. :: Use a copy of the backup as a double safety
  18. copy "%ConfigNTbak%" "%temp%\CONFIG.NT">nul
  19. ::
  20. :: Customize CONFIG.NT to use ANSI.SYS
  21. > "%ConfigNT%" echo DOSONLY
  22. >>"%ConfigNT%" echo dos=high, umb
  23. >>"%ConfigNT%" echo device=%%SystemRoot%%\system32\himem.sys
  24. >>"%ConfigNT%" echo files=40
  25. >>"%ConfigNT%" echo DEVICE=%WinDir%\System32\ANSI.SYS /x
  26. ::
  27. :: Choose the MS-DOS color
  28. command /cecho ANSI.SYS turn on
  29. ::
  30. :: Restore the original CONFIG.NT
  31. copy "%temp%\CONFIG.NT" "%WinDir%\System32\">nul
  32. if exist "%temp%\CONFIG.NT" del "%temp%\CONFIG.NT">nul
  33. endlocal & goto :EOF
复制代码
原帖地址:http://www.cn-dos.net/forum/viewthread.php?tid=30382




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2