[Tutor] ANSI / VT100 Escape Codes in Windows 7 Environment

Alan Gauld alan.gauld at yahoo.co.uk
Wed Feb 27 20:03:28 EST 2019


On 27/02/2019 18:28, Chip Wachob wrote:
> Windows 7 vintage machine this morning. 

Caveat: I have no direct experience on Windows 7 - I jumped
from XP to Windows 8... Also I haven't used ANSIO codes in
Windows since the heady days of Windows 98! But...

> run in the command window in Windows, from the terminal in Linux...

Be aware that ANSI codes in DOS don't correspond directly
with the VT100 control codes commonly used in Linux etc.
You might get some things that either don;t work or work
slightly differently.

> In the code I had included the ANSI escape characters so I could invert the
> text and change the color. 

Again remember that old ANSI terminals didn't have colors.
(They were either green on black, white on black, or if you
were really fancy, amber on black).

Color came later so some terminal emulators won't do anything
with those codes.

> As I have now learned, Windows 7 does not support this functionality.
> What do the experts out there suggest as the path of least pain and
> suffering?

No idea if this works on Windows 7 but what we used to have
to do was load the ANSI.SYS driver in the CONFIG.SYS file
located in the root directory of the boot drive.

A quick Google suggests that Windows supports config.nt
as a replacement for CONFIG.SYS.

Try creating such a file (or editing the existing one) with the line

DEVICE=ANSI.SYS

And see if that helps. (You might need a reboot or at
least a restart of the console)

Also it seems that the 32 bit version of ANSI.SYS does not support
cursor positioning. But if you only want bold/flashing/underlined
text in differing colors you should be OK...


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list