CMD.EXE was modified such that its internal commands do support the ANSI sequences. For example, the ANSI sequences are active if you TYPE a file that contains them, or ECHO a string that contains them.
But external commands like FINDSTR and CSCRIPT do not enable the ANSI escape sequences. So the file that worked with TYPE does not work when using FINDSTR.
But I recently learned that the above behavior is just the default Over at SuperUser.com I learned of a registry setting that enables ANSI escape sequences for all console programs that do not explicitly disable them
For me this information is important because it enabled me to add a "highlight matched/replaced text' feature to my JREPL.BAT regular expression text processor. I plan to release version 8 imminently.SuperUser.com user Glenn Slayden wrote: Fortunately, the global default can be changed from opt-in to opt-out. The registry key at HKEY_CURRENT_USER\Console\VirtualTerminalLevel sets the global default behavior for processing ANSI escape sequences. Create a DWORD key (if necessary) and set its value to 1 to globally enable (or 0 to disable`) ANSI processing by default.Note that this registry setting controls a default, meaning that it only affects console apps which don't explicitly manipulate the console mode by calling SetConsoleMode(...). It follows that, while the registry value may help enable ANSI for console-mode-oblivious apps, it will have no effect on any console-mode-savvy app which (for some reason) may explicitly disable ANSI.
Code: Select all