I am currently facing an issue when trying to echo some text in color with a batch script.
My issue only happens when I try to echo in color after another command (git command here) depending on the status code of the previous command : with && or ||.
Example:
@echo off
cls
for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
echo %ESC%[92mGreen%ESC%[0m
echo %ESC%[91mRed%ESC%[0m
echo %ESC%[92mGreen%ESC%[0m && echo %ESC%[91mRed%ESC%[0m
git pull || echo %ESC%[92mGreen%ESC%[0m && echo %ESC%[91mRed%ESC%[0m
pause
As you can see, echo in color doesn't work anymore after my git pull command. This will be the same if I use && instead of || and if git pull returns success.
Any idea ?
Thanks.