Question:
How can I get cmd.exe to display ANSI color escape sequences?
Clint P
2007-04-02 21:02:30 UTC
I'm having a devil of a time trying to get the WIndows XP cmd.exe (not command.com) to accept standard ANSI color sequences, such as ^[[32mGreen.

From everything I have gathered, cmd.exe does not support ANSI colors? It's difficult to wrap my head around this mistake if Microsoft truly made it, its just difficult to believe they would have ignored ANSI support.

Any help would be *greatly* appreciated.
Three answers:
Dan A
2007-04-02 22:08:39 UTC
cmd.exe does not support it natively after win 98



but...



according to wikipedia:



Support is built in on Linux. Windows 95, Windows 98 and DOS systems need a device driver for the ANSI codes - the de facto standard being ANSI.SYS, but others are used as well. Console windows in Windows versions based on NT (NT4, 2000 Professional, 2000 Server, XP, Server 2003, Vista, Server "Longhorn") do not natively support ANSI Escape sequences, though some support is possible. By adding the following line to the CONFIG.NT file located in the Windows System32 directory, ANSI output from 16-bit legacy programs executing under the NTVDM will be interpreted:



DEVICE=ANSI.SYS



Some support is also offered through alternate command processors such as JP Software's 4NT.



In other words, 32-bit character-mode windows applications can not write ANSI escape sequences to the console, but must interpret their actions and call the native Console API intrinsic to accomplish the proper result. Note that the window's Console API does have some restrictions regarding blink, underline and reverse VGA attributes. In exchange for blink, the screen allows for bright background colors. No access from user-mode is given to set the underline registers.
?
2016-09-29 08:55:13 UTC
Ansi Escape Sequences
?
2016-12-17 12:37:03 UTC
Ansi Colors


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...