Ansi.sys


Ansi.sys
Ansi Escape Sequences
Ansi Commands
Ansi Key Codes
Index

Ansi.sys is an enhancement of the "CON" device driver built into Command.com. It can be used to modify the default display colours, the position of the cursor, and how keystrokes are interpreted. It can also be used to change the video mode.

Syntax

Ansi.sys can only be loaded in Config.sys using a Device or DeviceHigh statement.

Device=[Path]Ansi.sys [/X|/K] [/R] or
DeviceHigh=[Path]Ansi.sys [/X|/K] [/R]

PathThe full path (usually: c:\windows\command). Default is the root directory of the start-up drive (usually C:/)
/XEnables remapping of the extended keys on a 101-key keyboard.
/KCauses a 101-key keyboard to behave as an 84-key keyboard.
/RInvalid switch (?)
/LValid but not functional 1
/S[/SCREENSIZE] ?
/S=n: Sets the maximum number of lines to reserve for a screen buffer. Set n=43 or 50 to support full use of EGA/VGA 43/50-line screens. Or use /S=1 to save memory when the screen save/recall function is not used. Default is /S=25
/RApparently no longer a valid switch

Notes

  1. Once Ansi.sys has been loaded, it's various functions can be accessed at any time by sending one or more Escape Sequences to the screen. These are tabulated in Ansi Commands

  2. Unfortunately, Escape Sequences cannot be directly entered at the command line because the first character (ASCII 27 or "ESC") is interpreted as an instruction to "clear the command line" which doesn't get you very far. Fortunately, a number of workarounds have been developed - see Ansi Escape Sequences.

  3. The most common situations in which Ansi.sys is called for are:
    1. The construction of fancy prompts and menus (see PROMPT); and
    2. Remapping little used keys on the keyboard
    It should be appreciated that most DOS programs write directly to the screen and bypass Ansi.sys altogether. Thus both colour and keyboard changes will generally only apply when using Dos commands and the supplied utilities such as FDISK and FORMAT.

  4. As far as I can determine, the "extended keys" that can be remapped by including the /X switch are the 10 keys between the main and number keypads on the standard 104 key keyboard - ie. Insert, Home, Page Up, Page Down, Delete, End, and the cursor keys. These keys all have scan codes beginning with 224 and it appears that, without the /X switch, this is read as "0" and become indistinguishable from the equivalent keys on the number keypad.

  5. According to Msdosdrv.txt on the Win98SE CD, the /R switch
    "Adjusts line scrolling to improve readability when ANSI.SYS is used with screen-reading programs (which make computers more accessible to people with disabilities)"
    However, on my machine Ansi.sys will not load when this switch is specified. Furthermore, scanning through the code with EDIT, I can find /X, /K/, /L, /S and /SCREENSIZE - but no trace of /R. Very odd!

File Details

File NameDefault LocationDos Ver.Win Ver.SizeDateSource
Ansi.sysc:\windows\command 7.0Win95 9 719111/07/95win95_09.cab
7.1Win95 (OSR2.x) 9 719224/08/96win95_14.cab
Win98 9 719211/05/98win98_46.cab
Win98 SE 9 719223/04/99win98_52.cab

Superscripts denote which same size files, if any, are identical (using FC).


1 Thanks to Mark Dormer for pointing out the MS Knowledge Base article Q74182
This page last revised:
January 1, 2003.