CON, Switches=/K, ANSI.SYS /K, and Reading Keyboard Input

Article translations Article translations
Article ID: 81740 - View products that this article applies to.
This article was previously published under Q81740
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all


MS-DOS versions 4.x and later read information from extended or enhanced (101 and 102 key) keyboards differently than from standard (84 key) keyboards. This allows, for example, MS-DOS to determine which ENTER key is pressed on enhanced keyboards.

Some older terminate-and-stay-resident (TSR) programs that hook into the keyboard interrupt don't recognize there are two ways to read from enhanced keyboards. It is possible in MS-DOS 4.x and later for TSRs (and other applications) to fail because of this change in how MS-DOS reads from enhanced keyboards.

If you encounter problems using the keyboard after upgrading to MS-DOS 4.x or later, it may be related to this change. You can force MS-DOS to read from enhanced keyboards like standard keyboards. If you are not using ANSI.SYS, use the following command in the CONFIG.SYS file:
If you are using ANSI.SYS, load it using the /K switch. For example:
   device=c:\dos\ansi.sys /k

More information

The internal MS-DOS CON[sole] device driver is responsible for reading input from the keyboard and displaying character output on the screen. Whenever possible, MS-DOS operates through the ROM BIOS, and CON is no exception. CON uses the ROM BIOS Interrupt 16h service to access the keyboard.

In MS-DOS 1.x, 2.x, and 3.x, CON always uses INT 16h function 0h to read characters from the BIOS keyboard buffer and function 1h to check the keyboard status.

In MS-DOS 4.x, 5.x, 6.0, and 6.2, MS-DOS uses INT 16h functions 10h and 11h if an enhanced keyboard is present. Functions 10h and 11h were added to these versions to support enhanced keyboards on ATs and PS/2s.

Enhanced keyboards have two of each of the following keys in addition to ARROW keys.

  • CTRL
  • ALT
  • HOME
  • END
When using INT 16h functions 0h and 1h to read these keys, they both appear the same. When using INT 16h functions 10h and 11h, it is possible to tell which ENTER or HOME key is pressed. Functions 10h and 11h also allow MS-DOS to read function keys F11 and F12.

The CONFIG.SYS command SWITCHES=/K causes CON to use functions 0h and 1h when reading from enhanced keyboards. This is necessary when an application program assumes that MS-DOS uses functions 0h and 1h to read input.

ANSI.SYS is an enhanced console device driver that substitutes itself for the default CON device driver. When ANSI (or any other substitute console device driver) loads, it overrides the default CON device driver by reporting itself as "CON" (MEM /D reports device names). Like the default CON driver, ANSI.SYS uses functions 10h and 11h in MS-DOS 4.x and later. To force ANSI.SYS to read keyboard input using functions 0h and 1h, load ANSI.SYS with the /K switch.

NOTE: Although ANSI.SYS useS functions 10h and 11h when reading from enhanced keyboards, to remap the extended keys separately from their 84-key counterparts using ANSI escape sequences, you must load ANSI.SYS using the /X switch.


Article ID: 81740 - Last Review: October 26, 2013 - Revision: 3.0
Applies to
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition
kbnosurvey kbarchive KB81740

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from