Ansi. How to use the SYS program _dos/bat

Source: Internet
Author: User
Tags switches
Ansi. SYS is a very useful device driver in MS-DOS, and we can use it to achieve unexpected results. So, how does it work? Let me introduce you to the following.
Note: In this section, uppercase letters in the syntax and ANSI escape sequences must be typed as-is.
Ansi. SYS defines a series of functions that are used to change display graphics, control cursor movement, and key redefinition, ANSI. The SYS device driver supports ANSI terminal emulation of the escape sequence to control the screen and keyboard of the system.
The device driver must be located in CONFIG. The device or Devicehigh command in the SYS file is loaded.
Grammar
DEVICE (High) =[drive: [path]ansi. SYS [/x] [/k] [/R]
Parameters
[Drive:] Path
Specifies ANSI. The location of the SYS file.
Options
/x
Remap an extension key other than the 101-key keyboard.
/k
Make ANSI. The SYS file treats the 101-key keyboard as a 84-key keyboard, which is equivalent to command switches=/k. If you typically use the switches=/k command, you need to use the option/k when using Ansi.sys.
/R
When ANSI. SYS, when used with screen readers, which makes it easier for people with disabilities to use computers, this option adjusts the scrolling of rows to improve readability.
Parameters used in the ANSI escape sequence:

Numeric parameter that specifies a decimal number.

Optional parameters. Specifies a decimal number that is used to select a function. You can specify multiple functions that must be separated by semicolons (;) Separates the arguments.
Pl
Row arguments. Specifies a decimal number that represents a row on the monitor or other device.
Pc
Column parameters. Specifies a decimal number that represents a column on the screen or other device.
Settings for the cursor movement, graphics, and keyboard in the ANSI escape sequence:
In the list of the following ANSI escape sequence, the abbreviation ESC represents the ASCII escape character (1Bh), which is at the beginning of each escape sequence.
ESC[PL; Pch
Cursor Position: Moves the cursor to the specified position (coordinates), and if you do not specify a position, the cursor moves to the starting position, which is the upper-left corner of the screen (0 rows, 0 columns).
The escape sequence works the same way as the following escape sequence for the cursor position.
ESC[PL; Pcf
Cursor Position: The previous cursor position escape sequence works the same way.
Esc[pna
Move up cursor: Moves the cursor up the specified number of rows without changing the column. ANSI If the cursor is already in the first row. SYS ignores this sequence.
Esc[pnb
Move cursor down: Moves the cursor down the specified number of rows without changing the column. ANSI If the cursor is already on the last line. SYS ignores this sequence.
Esc[pnc
Move the cursor right: does not change the row and moves the cursor to the right by the specified number of columns. If the cursor is already in the right column, ANSI. SYS ignores this sequence.
Esc[pnd
Left cursor: Moves the cursor to the left with the specified number of columns without changing the row. If the cursor is already in the leftmost column, ANSI. SYS ignores this sequence.
Esc[s
Save cursor Position: Saves the current cursor position. Using the Restore cursor position sequence, you can move the cursor to a saved cursor position.
Esc[u
Restore cursor Position: Returns the cursor position to the location stored by the Save cursor location.
Esc[2j
Clear display: Clears the screen and moves the cursor position to the starting position (0 rows, 0 columns).
Esc[k
Clear rows: Clears all characters, including characters at the cursor position, from the cursor position to the end of the line.
Esc[ps;..; Psm
Set Graphics mode: Calls the graphical functions specified by the following values, which remain active until the sequence appears again. Graphic mode changes the color and text displayed on the screen (for example, bold and underline fonts) properties.
Text properties
Value function
------------------------------------
0 No attributes
1 blackbody
4 Underline font (for monochrome display adapters only)
5 Blinking Fonts
7 Anti-Display fonts
8 Hidden fonts
Foreground color
Value function
------------------------------------
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Purple-Red
36 Cyan
37 White
Background color
Value function
------------------------------------
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Purple-Red
46 Cyan
47 White
Parameters 30 to 47 conform to the ISO 6429 standard.
Esc[=psh
Set mode: Changes the screen width or type so that it is specified as one of the following values.
0 x 148 x 25 Monochrome (text)
1 x 148 x 25 Color (text)
2 x 148 x 25 Monochrome (text)
3 x 148 x 25 Color (text)
4 x 148 x 200 4 color (graphics)
5 x 148 x 200 monochrome (graphic)
6 640 x 148 x 200 monochrome (graphic)
7 Enable line wrapping function
148 x 200 Color (graphics)
640 x 148 x 200 Color (16-color graphics)
640 x 148 x 350 Monochrome (2-color graphics)
640 x 148 x 350 Color (16-color graphics)
640 x 148 x 480 Monochrome (2-color graphics)
640 x 148 x 480 Color (16-color graphics)
148 x 200 Color (256-color graphics)
Esc[=psl
Reset mode: Use the same value used in the set mode sequence to reset the mode, except 7, and using 7 will invalidate the newline function.
Note: The last character in the escape sequence is a lowercase L.
Esc[code;string;...p
Set keyboard string: Redefine the keyboard key to the specified string. The parameters of the escape sequence are defined as follows:
"Code" is one or more values that are listed in the following table, which represent a combination of keyboard keys and keys. When you use these values in a command, you must also type the semicolon that appears in the table, in addition to the number required for the sequence. The code in parentheses does not exist on some keyboards unless the option/x is ANSI. SYS is specified in the device command, otherwise ANSI. SYS will not translate the code in parentheses for these keyboards.
"String" is an ASCII code for a single character, or a string enclosed in quotation marks. For example: 65 and "a" are used to represent capital letter A.
Important: Some of the values in the following table are not valid for all computers, please check your computer documentation for those different values.
Key code shift+ code CTRL + code ALT + code
------------------------------------------------------------------
F1 0;59 0;84 0;94 0;104
F2 0;60 0;85 0;95 0;105
F3 0;61 0;86 0;96 0;106
F4 0;62 0;87 0;97 0;107
F5 0;63 0;88 0;98 0;108
F6 0;64 0;89 0;99 0;109
F7 0;65 0;90 0;100 0;110
F8 0;66 0;91 0;101 0;111
F9 0;67 0;92 0;102 0;112
F10 0;68 0;93 0;103 0;113
F11 0;133 0;135 0;137 0;139
F12 0;134 0;136 0;138 0;140
A 97 65 1 0;30
B 98 66 2 0;48
C 99 66 3 0;46
D 100 68 4 0;32
E 101 69 5 0;18
F 102 70 6 0;33
G 103 71 7 0;34
H 104 72 8 0;35
I 105 73 9 0;23
J 106 74 10 0;36
K 107 75 11 0;37
L 108 76 12 0;38
M 109 77 13 0;50
N 110 78 14 0;49
O 111 79 15 0;24
P 112 80 16 0;25
Q 113 81 17 0;16
R 114 82 18 0;19
S 115 83 19 0;31
T 116 84 20 0;20
U 117 85 21 0;22
V 118 86 22 0;47
W 119 87 23 0;17
X 120 88 24 0;45
Y 121 89 25 0;21
Z 122 90 26 0;44
1 49 33--0;120
2 50 64 0 0;121
3 51 35--0;122
4 52 36--0;123
5 53 37--0;124
6 54 94 30 0;125
7 55 38--0;126
8 56 42--0;126
9 57 40--0;127
0 48 41--0;129
-45 95 31 0;130
= 61 43--0;131
[91 123 27 0;26
] 93 125 29 0;27
92 124 28 0;43
; 59 58--0;39
39 34--0;40
, 44 60--0;51
. 46 62--0;52
/47 63--0;53
' 96 126--0;41
Normally, when the ESC key is pressed at a DOS prompt, the screen displays a backslash (\) and moves the cursor to the next line. You can use the PROMPT command. If now the DOS prompt is $p$g, want to clear the screen, you can type: prompt= $E [2J $P $g here $e means to press ESC , and then change the prompt back to $p$g, or you should clear the screen before executing each command.
You can enter the ESC character in the following ways when editing a batch file with edit. First press CTRL and P and then press the square brackets, and then a left arrow appears (? Note that the ESC character has been entered.) You must then release CTRL and press the bottom bracket key again to start the ANSI command.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.