Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page





Microsoft DOS ansi.sys command

Quick links

About ansi.sys
Availability
How to load
Command syntax
Switches
Parameters
Escape sequences
Technical Support

About ansi.sys

Defines functions that change display graphics, control cursor movement and reassign keys. The ANSI.SYS device driver supports ANSI terminal emulation of escape sequences to control your system's screen and keyboard. An ANSI escape sequence is a sequence of ASCII characters, the first two are the escape character (1Bh) and the left-bracket character (5Bh). The character or characters following the escape and left-bracket characters specify an alphanumeric code that controls a keyboard or display function. ANSI escape sequences distinguish between uppercase and lowercase letters; for example, "A" and "a" have completely different meanings.

Availability

The ansi.sys command is external file and is available in

MS-DOS 5.0 and above
Windows 95
Windows 98
Windows NT
Windows 2000
Windows XP

How to load

This device driver must be loaded by a device or devicehigh command in your CONFIG.SYS file.

To load this file within Windows 95/98 the config.sys must have:

device=c:\windows\command\ansi.sys

To load this file within Windows 3.x / Windows NT it would need:

device=c:\dos\ansi.sys

Index

Category:
MS-DOS

Companies:
Microsoft

Related Pages:
Operating systems

Resolved

Were you able to locate the answer to your questions?

Syntax

Syntax:

Device=[drive:][path]ANSI.SYS [/x] [/k] [/r]

Parameters:

[drive:][path] Specifies the location of the Ansi.sys file. Additional [drive:][path] specifies the location of the Ansi.sys file. Additional information on where to load these files can be found in the how to load section.

Switches

/x   Remaps extended keys independently on 101-key keyboards.
/k   Causes ANSI.SYS to treat a 101-key keyboard like an 84-key keyboard. This is equivalent to the command SWITCHES=/k. If you usually use the SWITCHES=/k command, you will need to use the /k switch with ANSI.SYS.
/r   Adjusts line scrolling to improve readability when ANSI.SYS is used with screen-reading programs (which makes computers more accessible to people with disabilities).

Parameters

Pn   Numeric parameter. Specifies a decimal number.
Ps   Selective parameter. Specifies a decimal number that you use to select a function. You can specify more than one function by separating the parameters with semicolons.
PL   Line parameter. Specifies a decimal number that represents one of the lines on your display or on another device.
Pc   Column parameter. Specifies a decimal number that represents one of the columns on your screen or on another device.

Escape sequences

ANSI escape sequences for cursor movement, graphics, and keyboard settings:

In the below list of ANSI escape sequences, the abbreviation ESC represents the ASCII escape character 27 (1Bh), which appears at the beginning of each escape sequence.

ESC[PL;PcH Cursor Position: Moves the cursor to the specified position (coordinates). If you do not specify a position, the cursor moves to the home position — the upper-left corner of the screen (line 0, column 0). This escape sequence works the same way as the below Cursor Position escape sequence.
ESC[PL;Pcf Cursor Position: Works the same way as the preceding Cursor Position escape sequence.
ESC[PnACursor Up: Moves the cursor up by the specified number of lines without changing columns. If the cursor is already on the top line, ANSI.SYS ignores this sequence.
ESC[PnBCursor Down: Moves the cursor down by the specified number of lines without changing columns. If the cursor is already on the bottom line, ANSI.SYS ignores this sequence.
ESC[PnCCursor Forward: Moves the cursor forward by the specified number of columns without changing lines. If the cursor is already in the rightmost column, ANSI.SYS ignores this sequence.
ESC[PnDCursor Backward: Moves the cursor back by the specified number of columns without changing lines. If the cursor is already in the leftmost column, ANSI.SYS ignores this sequence.
ESC[sSave Cursor Position: Saves the current cursor position. You can move the cursor to the saved cursor position by using the Restore Cursor Position sequence.
ESC[uRestore Cursor Position: Returns the cursor to the position stored by the Save Cursor Position sequence.
ESC[2JErase Display: Clears the screen and moves the cursor to the home position (line 0, column 0).
ESC[KErase Line: Clears all characters from the cursor position to the end of the line (including the character at the cursor position).
ESC[Ps;...;Psm Set Graphics Mode: Calls the graphics functions specified by the below values. These specified functions remain active until the next occurrence of this escape sequence. Graphics mode changes the colors and attributes of text (such as bold and underline) displayed on the screen.

Text attributes

0All attributes off
1Bold on
4Underscore (on monochrome display adapter only)
5Blink on
7Reverse video on
8 Concealed on

Foreground colors

30Black
31 Red
32Green
33Yellow
34Blue
35Magenta
36Cyan
37White

Background colors

40Black
41Red
42Green
43Yellow
44Blue
45Magenta
46Cyan
47 White

Parameters 30 through 47 meet the ISO 6429 standard.

ESC[=Psh

Set Mode: Changes the screen width or type to the mode specified by one of the below values:

040 x 148 x 25 monochrome (text)
140 x 148 x 25 color (text)
280 x 148 x 25 monochrome (text)
380 x 148 x 25 color (text)
4320 x 148 x 200 4-color (graphics)
5320 x 148 x 200 monochrome (graphics)
6640 x 148 x 200 monochrome (graphics)
7Enables line wrapping
13320 x 148 x 200 color (graphics)
14640 x 148 x 200 color (16-color graphics)
15640 x 148 x 350 monochrome (2-color graphics)
16640 x 148 x 350 color (16-color graphics)
17640 x 148 x 480 monochrome (2-color graphics)
18 640 x 148 x 480 color (16-color graphics)
19320 x 148 x 200 color (256-color graphics)

Reset Mode: Resets the mode by using the same values that Set Mode uses, except for 7, which disables line wrapping. The last character in this escape sequence is a lowercase L.

ESC[code;string;...p

Set Keyboard Strings: Redefines a keyboard key to a specified string. The parameters for this escape sequence are defined as follows:

  • Code is one or more of the values listed in the below table. These values represent keyboard keys and key combinations. When using these values in a command, you must type the semicolons shown in this table in addition to the semicolons required by the escape sequence. The codes in parentheses are not available on some keyboards. ANSI.SYS will not interpret the codes in parentheses for those keyboards unless you specify the /x switch in the device command for ANSI.SYS.
  • String is either the ASCII code for a single character or a string contained in quotation marks. For example, both 65 and "A" can be used to represent an uppercase A.

Important: Some of the values in the below table are not valid for all computers. Check your computer's documentation for values that are different.

ASCII Key Codes

KeyCode^SHIFT^+code^CTRL^+codeALT+code
F10;590;840;940;104
F20;600;850;950;105
F30;610;860;960;106
F40;620;870;970;107
F50;630;880;980;108
F60;640;890;990;109
F70;650;900;1000;110
F80;660;910;1010;111
F90;670;920;1020;112
F100;680;930;1030;113
F110;1330;1350;1370;139
F120;1340;1360;1380;140
HOME (num keypad) 0;71550;119-
UP ARROW (num keypad) 0;7256(0;141)-
PAGE UP (num keypad)0;73570;132-
LEFT ARROW (num keypad) 0;75520;115-
RIGHT ARROW (num keypad) 0;77540;116-
END (num keypad)0;79490;117-
DOWN ARROW (num keypad) 0;8050(0;145)-
PAGE DOWN (num keypad)0;81510;118-
INSERT (num keypad)0;8248(0;146)-
DELETE (num keypad)0;8346(0;147)-
HOME(224;71) (224;71)(224;119)(224;151)
UP ARROW(224;72)(224;72)(224;141)(224;152)
PAGE UP(224;73)(224;73)(224;132)(224;153)
LEFT ARROW(224;75)(224;75)(224;115)(224;155)
RIGHT ARROW(224;77)(224;77)(224;116)(224;157)
END(224;79)(224;79)(224;117)(224;159)
DOWN ARROW(224;80)(224;80)(224;145)(224;154)
PAGE DOWN(224;81)(224;81)(224;118)(224;161)
INSERT(224;82)(224;82)(224;146)(224;162)
DELETE(224;83) (224;83)(224;147)(224;163)
PRINT SCREEN--0;114-
PAUSE/BREAK--0;0-
BACKSPACE88127(0)
ENTER13010(0
TAB90;15(0;148)(0;165)
NULL0;3---
A976510;30
B986620;48
C996630;46
D1006850;18
E101 6950;18
F1027060;33
G1037170;34
H1047280;35
I1057390;23
J10674100;36
K10775110;37
L10876120;38
M10977130;50
N11078140;49
O11179150;24
P11280160;25
Q11381170;16
R11482180;19
S11583190;31
T11684200;20
U11785210;22
V11886220;47
W11987230;17
X12088240;45
Y12189250;21
Z12290260;44
14933-0;120
2506400;121
35135-0;122
45236-0;123
55337-0;124
65494300;125
75538-0;126
85642-0;126
95740-0;127
04841-0;129
-4595310;130
=6143-0;131
]91123270;26
[93125290;27
92124280;43
;5958-0;39
'3934-0;40
.4660-0;51
/4763-0;53
`3934-0;40
ENTER (keypad)13-10(0;116)
/ (keypad)4747(0;142)(0;74)
* (keypad)42(0;144)(0;78)-
- (keypad)4545(0;149)(0;164)
+ (keypad)4343(0;150)(0;55)
5 (keypad)(0;76)53(0;143)-

 

TECHNICAL SUPPORT
ReferenceIssue / Question
CH000361MS-DOS issues with Windows ME.

Home - Computer help - Contact - Site Map - About Us
Link to Computer Hope - Bookmark Computer Hope