bat echo 每行不同的颜色
先看代码:
@echo off SETLOCAL EnableDelayedExpansion for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a" ) rem echo say the name of the colors, don't read :start rem cls call :ColorText 0a "blue" call :ColorText 0C "green" call :ColorText 0b "red" echo. call :ColorText 19 "yellow" call :ColorText 2F "black" call :ColorText 4e "white" echo. echo aaaaaa pause goto :eof :ColorText echo off <nul set /p ".=%DEL%" > "%~2" findstr /v /a:%1 /R "^$" "%~2" nul del "%~2" > nul 2>&1 goto :eof
使用:
1.你的代码放在 :start 和第一行 goto :eof之间
2.换行使用 echo.
3.最好使用双引号把内容括起来,不然遇到空格就会报拒绝访问的错误