Hi All
I want to give different font colours for some of the texts in bat file. Please look at the following bat file.
@echo off
echo List of Reports
echo Staff List
echo Responsible Works
pause
I want to give red colour for "List of Report" text and green colour for both "Staff List" and "Responsible Works" texts. Please advice me how to do it.
Thank You
How to give different font colors in bat file
Moderator: DosItHelp
Re: How to give different font colors in bat file
@!k Ansi.sys is to complex
Try this simple pure batch solution
Output
List of Reports
Staff List
Responsible Works
hope it helps
jeb
Try this simple pure batch solution
Code: Select all
@echo off
SETLOCAL DisableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
call :ColorText 0C "List of Reports"
call :ColorText 0a "Staff List"
call :ColorText 0b "Responsible Works"
goto :eof
:ColorText
echo off
<nul set /p .=. > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
echo(%DEL%%DEL%%DEL%
del "%~2" > nul 2>&1
goto :eof
Output
List of Reports
Staff List
Responsible Works
hope it helps
jeb
Re: How to give different font colors in bat file
Congratulations, jeb. Nobody else thought about FINDSTR.
Regards
aGerman
Regards
aGerman
Re: How to give different font colors in bat file
jeb wrote:Ansi.sys is to complex
I've always been confused by ANSI too