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]
Path | The full path (usually: c:\windows\command). Default is the root directory of the start-up drive (usually C:/) |
/X | Enables remapping of the extended keys on a 101-key keyboard. |
/K | Causes a 101-key keyboard to behave as an 84-key keyboard. |
/R | Invalid switch (?) |
/L | Valid 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
|
/R | Apparently no longer a valid switch |
Notes
- 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
- 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.
- The most common situations in which Ansi.sys is called for are:
- The construction of fancy prompts and menus (see PROMPT); and
- 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.
- 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.
- 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 Name | Default Location | Dos Ver. | Win Ver. | Size | Date | Source |
Ansi.sys | c:\windows\command |
7.0 | Win95 |
9 7191 | 11/07/95 | win95_09.cab |
7.1 | Win95 (OSR2.x) |
9 7192 | 24/08/96 | win95_14.cab |
Win98 |
9 7192 | 11/05/98 | win98_46.cab |
Win98 SE |
9 7192 | 23/04/99 | win98_52.cab |
Superscripts denote which same size files, if any, are identical (using FC).
|