Getting selective color output in a command cosole is difficult. In the days of DOS you could use ANSI escape codes via ANSI.SYS. But that does not work on modern Windows machines (definitely not 64 bit machines, and possibly not even 32 bit machines)
You can use PowerShell to output a single line in color. For example:
powershell write-host -foregroundcolor Red "Hello world"
But the context switching is very slow.
There are also batch file hacks that use FINDSTR to selectively output strings in color. See How to echo with different colors in the Windows command line.
But both of the above techniques require you to provide the color when the content is generated. But you want to selectively color the text after it has already been generated.
There certainly isn't any native utility that can do what you want. Perhaps there is a 3rd party tool that can search stdin and highlight matches in red, but I'm not familiar with any.
Instead of using color, you might consider reformatting each line that contains the string of interest. For example, matching lines could be prefixed with a string like
>>>>>>>>>>. To accomplish this you need two things: 1) A regex line based search and replace utility, 2) the ability to pipe your test results to the utility.
I have written a hybrid JScript/batch utility called REPL.BAT. It performs a regex search and replace on stdin and writes the result to stdout. The utility is pure script, so no 3rd party executeables are needed. It runs on any Windows machine from XP onward. Full documentation is built into the script.
Assuming REPL.BAT is in your current directory, or better yet, somewhere within your PATH:
yourAutomatedTestCommand | repl ".*\bnot ok\b.*" ">>>>>>>>>> $&" i
The command above will only modify lines that contain
not ok (case insensitive) at word boundries. There are many options for how you reformat the line of interest. For example, entire lines can be added both before and after the line using the
X option coupled with the
\n newline escape sequence.