How can I get cmd.exe to display ANSI color escape sequences?

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.

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    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.

  • holden
    Lv 4
    4 years ago

    Ansi Escape Sequences

  • 4 years ago

    Ansi Colors

Still have questions? Get your answers by asking now.