I recently found a post that gave a solution to have the text output by stderr a different color for Linux (bash)
They created the following bash script script
#!/bin/bash
{ $* 2>&1>&3|sed 's,.*,\x1B[33m&\x1B[0m,'>&2;} 3>&1
this causes the output to print yellow text when it is from stderr. stdout still prints the same color.
the script was saved in a directory on $PATH called color. This allows me to run the script with make or scons and it will hi-lite all of the text from stderr in yellow. (could make the text red by changing 33m to 31m)
color make CPU=x64
This is quite useful for finding errors when compiling.
Is there a similar script that could be used for Windows cmd shell?
Note: I have sed installed on my windows computer if that is helpful.
As for support for ANSI escape codes under Windows’ cmd.exe, see ansicon. After translating your redirection logic to cmd.exe syntax I prepared the following
color.batfile:Unfortunately the streams get mixed (on some lines the characters from stdout and stderr are mixed together in single line). Maybe this behavior depends on version of sed.exe used, so give it a try.
If this does not work, consider using a minimum cygwin install. I tested your
color.shscript and I was able to launch a .bat file and it worked correctly without mixing streams. The syntax I used was: