批处理之家's Archiver

neorobin 发表于 2009-12-13 22:07

批处理彩色显示字符串

[code]@echo off & color 0f
set tempDir=%HOMEDRIVE%\~colorIt
(md !tempDir! 2>nul)&(call :delFiles %tempDir%)&(cd /d %tempDir%)&(set /p=<nul>temp)
(call :colorIt 01 蓝)&(call :colorIt 02 绿)&(call :colorIt 04 红)&(call :colorIt 06 黄)
(call :colorIt f0 彩色显示关键是)&(call :colorIt 24 findstr-a参数)&(call :colorIt 16 的使用和含一个退格字符的文件)
(call :delFiles %tempDir%)&pause & color /? & pause &exit /b

:colorIt !color! !it!
ren temp %2>nul 2>nul
findstr -a:%1 . %2*
ren %2 temp>nul 2>nul
exit /b

:delFiles 强力删除一个目录中的所有文件
del /f /a /q \\?\%1
exit /b[/code]

Batcher 发表于 2009-12-13 22:12

相关讨论

CMD里显示彩色文字
[url]http://bbs.bathome.net/thread-1852-1-1.html[/url]

批处理单行输出彩色字符
[url]http://bbs.bathome.net/thread-1853-1-1.html[/url]

批处理单行显示多种颜色字符
[url]http://bbs.bathome.net/thread-1854-1-1.html[/url]

批处理显示彩色字符的原理及其中退格符的作用
[url]http://bbs.bathome.net/viewthread.php?tid=1331#pid11864[/url]

页: [1]

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