mode(CMD) 19 June 1992 mode(CMD) Name mode - configure system devices Syntax Because the mode command can perform many different tasks, the syntax necessary to carry out each task is different: + configuring printers mode lptn[:] [c][,[l][,r]] mode lptn[:] [cols=c] [lines=l] [retry=r] + configuring serial ports mode comm[:] [b[,p[,d[,s[,r]]]]] mode comm[:] [baud=b] [parity=p] [data=d] [stop=s] [retry=r] + displaying device status mode [device] [/status] + redirecting printer output mode lptn[:]=comm[:] + setting device code pages mode device codepage prepare=((yyy[...]) [drive:][path]filename) mode device codepage select=yyy mode device codepage refresh mode device codepage [/status] + setting display modes mode [display-adapter][,shift [,t]] mode [display-adapter][,n] mode con[:] [cols=c] [lines=n] + setting the typematic rate mode con[:] [rate=r delay=d] Description The mode command performs a variety of different tasks, including: + reconfiguring a printer attached to a parallel port (PRN, LPT1, LPT2, or LPT3) for printing at 80 or 132 characters per line, 6 or 8 lines per inch, or both (if the printer supports these features). See ``Configuring printers.'' + configuring the baud rate, parity, and number of data bits and stop bits of a serial communications port (COM1, COM2, COM3, and COM4) for use with a specific printer, modem, or other serial device. See ``Configuring serial ports.'' + displaying the status of all devices or of a single device. See ``Dis- playing device status.'' + redirecting printer output from a parallel port to a serial port so that the serial port becomes the system's default printer port. See ``Redirecting printer output.'' + preparing devices for code-page switching. See ``Setting device code pages.'' + selecting another display adapter or changing the configuration of the current display adapter. See ``Setting display modes.'' + setting the keyboard's typematic rate. See ``Setting the typematic rate.'' Configuring printers mode lptn[:] [c][,[l][,r]] mode lptn[:] [cols=c] [lines=l] [retry=r] This version of the mode command sets the characteristics for an IBM- compatible or Epson-compatible printer connected to a parallel printer port (PRN, LPT1, LPT2, or LPT3). lptn specifies the parallel port to which the device is attached. Valid values for n are in the range 1 through 3. If you omit any of the following three parameters, mode uses the most recent setting for the omitted parameter. If you are using the shorter form of the syntax (without the words cols=, lines=, and retry=), the mode command ``recognizes'' the parameters by their positions. Thus, if you do not specify a value for a parameter, you must still type the comma that precedes the next parameter. cols=c specifies the number of characters (columns) per line: 80 or 132. The default value is 80. You can abbreviate this parameter by simply omitting cols= and specifying a value for c. lines=l specifies the vertical spacing and the number of lines per inch: 6 or 8. The default value is 6. You can abbreviate this parameter by simply omitting lines= and specifying a value for l. retry=r specifies the retry action to take if a time-out error occurs when mode attempts to send output to a parallel printer. This parameter causes part of mode to remain resident in mem- ory. The following list shows each valid value for r and a brief description of its meaning: e Return an error from a status check of a busy port. b Return ``busy'' from a status check of a busy port. p Continue retrying until printer accepts output. r Return ``ready'' from a status check of a busy port. n Take no retry action (default value). You can also specify none for this value. If you are using the mode command over a network, do not use any of the r values. You can abbreviate this parameter by simply omitting retry= and specifying a value for r. Update to mode parameter The retry=b setting provides the same support as the p parameter did in previous versions of MS-DOS. Breaking out of a time-out loop To break out of a time-out loop, press Ctrl+C. Setting parallel-printer modes For parallel-printer modes, you can use PRN and LPT1 interchangeably. Suppose you want to be able to print 80 characters per line and 8 lines per inch on a parallel printer that is connected to the second parallel printer port (LPT2). To do this, type the following command: mode lpt2:80,8 Because 80 characters per line is the default setting, however, you could achieve the same result typing the following command: mode lpt2:,8 Suppose that, when printing a file, you want your system to keep trying to print the file until it is successful. To do this, type the following command: mode lpt2:,8,b To stop your system from continually retrying to print, press CtrlC or type the mode command without specifying a value for r. Configuring serial ports mode comm[:] [b[,p[,d[,s[,r]]]]] mode comm[:] [baud=b] [parity=p] [data=d] [stop=s] [retry=r] This version of the mode command sets the parameters for a serial port (COM1, COM2, COM3, or COM4). comm specifies the number of the asynchronous-communications (COM) port. Valid values for m are in the range 1 through 4. If you omit any of the following five parameters, mode uses the most recent setting for the omitted parameter. If you are using the shorter form of the syntax (without the words baud=, parity=, data=, and so on), the mode command ``recognizes'' the parameters by their positions. Thus, if you do not specify a value for a parameter, you must still type the comma that precedes the next parameter. baud=b specifies the first two digits of the transmission rate in bits per second. The following list shows each valid value for b and its related rate: 11 110 baud 15 150 baud 30 300 baud 60 600 baud 12 1200 baud 24 2400 baud 48 4800 baud 96 9600 baud 19 19,200 baud The b value of 19 is not supported on all computers (check your hardware manual). You can abbreviate this parameter by simply omitting baud= and specifying a value for b. parity=p specifies how the system uses the parity bit to check for transmission errors. The p value can be one of the follow- ing: n (none), e (even), o (odd), m (mark), or s (space). The default value is e. Not all computers support the values m and s. You can abbreviate this parameter by simply omit- ting parity= and specifying a value for p. data=d specifies the number of data bits in a character. Valid values for d are in the range 5 through 8. The default value is 7. Not all computers support the values 5 and 6. You can abbreviate this parameter by simply omitting data= and speci- fying a value for d. stop=s specifies the number of stop bits that define the end of a character: 1, 1.5, or 2. If the baud rate is 110, the default value is 2; otherwise, the default value is 1. Not all computers support the value 1.5. You can abbreviate this parameter by simply omitting stop= and specifying a value fors. retry=r specifies the retry action to take if a time-out error occurs when mode attempts to send output to a parallel printer. This parameter causes part of mode to remain resident in mem- ory. The following list shows each valid value for r and a brief description of its meaning: e Return an error from a status check of a busy port. b Return ``busy'' from a status check of a busy port. p Continue retrying until printer accepts output. r Return ``ready'' from a status check of a busy port. n Take no retry action (default value). You can also specify none for this value. If you are using the mode command over a network, do not use any of the r values. You can abbreviate this parameter by simply omitting retry= and specifying a value for r. The retry=b setting provides the same support as the p parameter did in previous versions of MS-DOS. Displaying device status mode [device] [/status] To display the status of all devices installed on your system, use the following syntax: mode device specifies the name of the device for which you want to dis- play the status. /status requests the status of any redirected parallel printers. The mode command, when used without this switch, displays the status of all installed devices except redirected parallel printers. You can abbreviate the /status switch as /sta. To display the status of the console, type the following command: mode con Redirecting printer output mode lptn[:]=comm[:] lptn specifies the parallel port. Valid values for n are in the range 1 through 3. comm specifies the serial port. Valid values for m are in the range 1 through 4. Suppose you want to set up your system so that it sends parallel-printer output to a serial printer. To do this, you must use the mode command twice. The first time, you use mode to configure the serial port; the second time, you use mode to redirect parallel-printer output to the serial port you specified in the first mode command. For example, if your serial printer operates at 4800 baud with even par- ity and is connected to the COM1 port (the first serial connection on your computer), type the following two commands: mode com1 48,e,,,b mode lpt1=com1 If you redirect parallel-printer output from LPT1 to COM1 but then decide that you want to print a file by using LPT1, use the following command before you print the file. This command prevents MS-DOS from redirecting the file from LPT1 to COM1. mode lpt1 Setting device code pages mode device codepage prepare=((yyy[...]) [drive:][path]filename) mode device codepage select=yyy mode device codepage refresh mode device codepage [/status] device specifies the device for which you want to prepare or select a code page. Valid names for device are con, lpt1, lpt2, and lpt3. codepage prepare prepares code pages for the specified device. You must prepare a code page for a device before you can use the code page with that device. After you use the codepage prepare form of the mode command, use the codepage select form of mode to specify the code page you want to use. You can abbreviate codepage and prepare as cp and prep, respectively. yyy specifies the number of the code page to prepare or select. The following list shows each code page that MS-DOS supports and its country or language: 437 United States 850 Multilingual (Latin I) 852 Slavic (Latin II) 860 Portuguese 863 Canadian-French 865 Nordic [drive:][path]filename specifies the location and name of the code-page-information (.CPI) file that MS-DOS uses to prepare a code page for the specified device. codepage select specifies (selects) which code page to use with the specified device. Before selecting a code page, you must use the codepage prepare form of the mode command to prepare a code page. You can abbreviate codepage and select as cp and sel, respectively. codepage refresh reinstates the prepared code pages if they are lost as the result of a hardware problem or other error. You can abbre- viate codepage and refresh as cp and ref, respectively. codepage displays the numbers of the code pages, if any, that are prepared or selected for the specified device. /status displays the numbers of the current code pages prepared or selected for the specified device. You can abbreviate this switch as /sta. Whether or not you specify the /status switch, typing the mode command with a device name and the codepage parameter displays the numbers of the code pages that are prepared or selected for the specified device. MS-DOS includes five .CPI files, which correspond to specific devices, as follows: _________________________________________________________________________ File Device _________________________________________________________________________ EGA.CPI Enhanced graphics adapter (EGA) or IBM Personal System/2 4201.CPI IBM Proprinters II and III Model 4201 IBM Proprinters II and III XL Model 4202 4208.CPI IBM Proprinter X24E Model 4207 IBM Proprinter XL24E Model 4208 5202.CPI IBM Quietwriter III printer LCD.CPI IBM PC Convertible liquid crystal display For information about other code-page commands, see the nlsfunc and chcp commands. Setting display modes mode [display-adapter][,shift [,t]] mode [display-adapter][,n] mode con[:] [cols=c] [lines=n] display-adapter specifies a setting category. The following list shows the value(s) associated with each setting category for display- adapter: 40 or 80 indicates the number of characters per line bw40 or bw80 specifies a color graphics adapter (CGA) with color disabled, and specifies the number of char- acters per line co40 or co80 specifies a color monitor with color enabled, and specifies the number of characters per line mono specifies a monochrome display adapter with a constant width of 80 characters per line shift specifies whether to shift the CGA screen to the left or to the right. Valid values for shift are l (for left) and r (for right). t enables you to align the screen by using a test pattern. MS-DOS prompts you to indicate whether the screen is aligned correctly. con[:] refers to the monitor. cols=c specifies the number of characters (columns) per line. Valid values are 40 and 80. lines=n specifies the number of lines that can be displayed on the screen. Valid values for n are 25, 43, and 50. Not all dis- play adapters support all three settings. To set the number of lines, you must have installed the ANSI.SYS device driver by using a device command in your CONFIG.SYS file. Setting the typematic rate mode con[:] [rate=r delay=d] The typematic rate has two components, the rate and the delay. Some key- boards do not recognize this command. con[:] refers to the keyboard rate=r specifies the rate at which a character is repeated on the screen when you hold down a key. Valid values are in the range 1 through 32. These values are equal to approxi- mately 2 to 30 characters per second, respectively. The default value is 20 for IBM AT-compatible keyboards, and 21 for IBM PS/2-compatible keyboards. If you set the rate, you must also set the delay. delay=d specifies the amount of time that must elapse-after you press and hold down a key-before MS-DOS starts to repeat the character. Valid values for d are 1, 2, 3, and 4 (representing 0.25, 0.50, 0.75, and 1 second, respec- tively). The default value is 2. If you set the delay, you must also set the rate. Notes Requirement for ANSI.SYS and DISPLAY.SYS mode can perform some tasks, such as setting the display mode, only if you have included a device command for the ANSI.SYS device driver in your CONFIG.SYS file. You must install DISPLAY.SYS to use mode (set device code pages) for code-page switching. Adding mode commands to AUTOEXEC.BAT Although you can type each form of the mode command at the command prompt, you can also use mode commands within your AUTOEXEC.BAT file to reconfigure your system automatically each time you turn on or restart your computer.