How can I print color text under "cmd.exe" in windows XP
Posted on 2004-11-21
I've tried putting ansi.sys into config.nt, but later discovered that this is not relevant to "cmd.exe" (and obviously, ansi escape sequences don't just work without something to handle them).
I've tried writing a driver to call int 10h, but this blows up on the int 10h call with the following error:-
Unhandled exception ...: 0xC0000005: Access Violation.
I don't recall an INT21 interface for changing color. I can't find any hints in MSVC++ help, nor google.
I know cmd.exe can *do* color, since after dropping into NTVDM and doing color there, it returns and retains the color on the cmd.exe's screen (and the cmd.exe's output overwrites both the residual outputted text as well as the color attributes, so whatever output routine cmd.exe is using, it's programmed to *do* colour it seems; and of course you can set everything to colors other than black+white (see cmd.exe /?)... it's just not clear how to have colored output!)