I am running a batch file with std output being redirected to a file and I want to get color text in the output that is being displayed on the console. I have found something that gives the color text, but I can't figure out how to send it to the console. This works, but not when stdout is redirected: How to have multiple colors in a Windows batch file?
I call the batch file like this:
mybatch >myoutput.txt
My batch file looks like this:
:: Sample Batch file
@echo off
@echo this goes to the text file when std output is redirected
@echo this goes to the console >CON
call :ColorText 19 "This uses the above referenced method to print in blue, but doesn't go to the console" & echo(
.
.
.
:ColorText
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof
How can I get that text to go to the console?