Ansi.sys


Entering "Escape Sequences"
The Commands
Keyboard 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] ?

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.sys 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 "Entering 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 me to the MS Knowledge Base article Q74182
If you should have any comments or suggestions,
please contact: Bob Watson
.
This page last revised:
August 26, 2000.