Color in pure batch (1 line different from others)

March 6, 2012 at 16:17:11
Specs: Windows Vista
it is solved!

@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"
)
echo say the name of the colors, don't read

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"
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

Just thought I should share, just put that in a batch file, run and be amazed


See More: Color in pure batch (1 line different from others)

Report •


#1
March 7, 2012 at 00:55:59
It's useful but it does have limitations.

Problem is that it uses filenames to output so that leaves a bunch of characters unusable.

|<>?:*/\"

And a few sequences too:

".."
"."
" "
"nul"
"con"
"prn"
"lpt1"
"aux"

There are probably more but I can't think of them just at the moment.


Report •
Related Solutions


Ask Question