Command: mode

  MODE configures and sets the state for various hardware devices
  and more.

Syntax:

  mode [device][options]  or:
  mode [screen mode]
       Devices:
         CON[:]  Console. This controls the display driver, which must
                 be installed first. MODE CON allows you to set your
                 screen's "codepage". This is useful because each
                 codepage lets you display different characters. For
                 more information on codepage see the CODEPAGE
                 INFORMATION PACK.
         LPT[:]  Parallel Ports
         COM[:]  Serial Ports
         PARK    Not implemented in FreeDOS mode.

Options:

  MODE [device] [/STA[TUS]]   Shows the status of one or all devices.
  MODE LPTn[:] cols[,[lines][,retry]]
  MODE LPTn[:] [COLS=...] [LINES=...] [RETRY=...]
                              Cols or cpi, 6/8 lpi, retry p or n
                              Retry: p infinite / n none
  MODE LPTn[:]=[COMn[:]|NUL]  Redirect printer data to serial port or NUL
  MODE COMn[:] baud,parity,data,stop,retry
  MODE COMn[:] [BAUD[HARD]=...] [PARITY=...] [DATA=...] [STOP=...]
               [RETRY=...]    Empty values allowed
                              Baud can be abbreviated to unique prefix,
                              parity can be o/e/n/s/m, the latter 2 mean
                              space/mark, data can be 5..8, stop 1..2.
                              Retry is IGNORED!
                              PLANNED: Retry b/e/r -> busy/error/ready
                              if busy, p/n infinite/no retry.
  MODE CON[:] [CP|CODEPAGE] [/STA[TUS]]
                              Shows the status of CON (console).
                              FreeDOS DISPLAY must be loaded before.
  MODE CON[:] [CP|CODEPAGE] REF[RESH]
                              Refreshes the active codepage to hardware.
                              FreeDOS DISPLAY must be loaded.
  MODE CON[:] [CP|CODEPAGE] PREP[ARE]=((codepage) filename)
                              FreeDOS DISPLAY must be loaded before.
                              Use PREP=((,cp2,cp3,,cp5)...) to prepare
                              codepages in other buffers.
  MODE CON[:] [CP|CODEPAGE] SEL[ECT]=number
                              FreeDOS DISPLAY must be loaded before.
  MODE CON[:] [NUMLOCK|CAPSLOCK|SCROLLLOCK|SWITCHAR]=value
                              Value can be: + or - for the locks or a
                              character for switchar.
  MODE CON[:] [COLS=...] [LINES=...]
                              Possible values depend on your hardware.
  MODE CON[:] [RATE=...] [DELAY=...]
                              Default rate 20, default delay 1. Rate can
                              be 1..32 for 2..30 char/sec, delay can be
                              1..4 for 1/4..4/4 sec.
  MODE [40|80|BW40|BW80|CO40|CO80|MONO][,rows]
                              These are the fix screen modes.
                              Rows can be 25, 28, 43 or 50. Use 8, 14 or
                              16 as 'rows' value if you only want to
                              change the font.
  MODE [CO40|CO80|...],[R|L][,T]
                              These are the flexible screen modes.
                              Values for columns are 40, 80, 132, rows
                              can be 25, 28, 30, 34, 43, 50, 60. Use 8,
                              14 or 16 as 'rows' value if you only want
                              to change the font.
                              Shift CGA left/right, T is interactive
                              mode.
  /?                          Shows the help.

Comments:

  CON (Console):
  This controls the display driver, which must be installed first.
  MODE CON allows you to set your screen's "codepage". This is useful
  because each codepage lets you display different characters. For mode
  information on codepage see the CODEPAGE INFORMATION PACK.
  Usage:
    MODE CON[:] CODEPAGE /STATUS
      Shows the active codepage and other information about the current
      status of DISPLAY and the codepage buffers.
    MODE CON[:] CODEPAGE REFRESH
      Refreshes the active codepage to hardware (in case it has been
      accidentaly destroyed)
    MODE CON[:] CODEPAGE PREPARE ((nnn) filename)
      Prepare codepage nnn from the specified file.
      The format of the files are .cpx and they are usually stored
      in C:\FREEDOS\CPI.
      For instance, codepage 860 is in EGA9.CPX. So you might use:
        MODE CON: CODEPAGE PREPARE ((860) c:\FREEDOS\CPI\ega9.cpx).
      See the CODEPAGE INFORMATION PACK for information
      about the available codepages and cpi files.
    MODE CON[:] CODEPAGE SELECT=nnn
      Activate codepage nnn, which must have been previously prepared
      with PREPARE.
    MODE CON[:] NUMLOCK=value
      Switches the numlock to ON or OFF. Value can be "+" or "-".
    MODE CON [:] CAPSLOCK=value
      Switches the capslock to ON or OFF. Value can be "+" or "-".
    MODE CON [:] SCROLLOCK=value
      Switches the scrollock to ON or OFF. Value can be "+" or "-".
    MODE CON [:] SWITCHAR=character
      Changes the DOS command line option switch character (usually
      "/")  to another character. Does not work with all commands.
    MODE CON [:] COLS=value
      Changes the columns. Value can be 40, 80 or 132.
    MODE CON [:] LINES=value
      Changes the lines. Value can be 25, 28, 43 or 50, or font size
      8, 14 or 16.
      If you have VESA, 30, 34 or 60 lines can be available too.
    MODE CON [:] RATE=value
      Changes the repeat rate. Value can be 1 ... 32 (2.0 chars/sec ...
      30.0 chars/sec after 0.50 sec delay).
    MODE CON [:] DELAY=value
      Changes the repeat delay. Value can be 1,2,3 or 4 (unit is 0.25
      seconds).
  The word CODEPAGE can be abbreviated to CP, STATUS to STA, REFRESH to
  REF, SELECT to SEL and PREPARE to PREP.
  MODE has ERRORLEVEL / EXITCODES that seem to be outdated (documentation
  is from 1995!); for this reason they are not published here. But the
  following seem to work:
    100:  INTERNAL ERROR: size for prepared table too small
    101:  No compatible FreeDOS DISPLAY driver loaded.
          Syntax example: ... DISPLAY CON=(VGA,437,1)
    102:  File not found
    103:  Error specifying codepage / buffer
    104:  Error: selected buffer not present
    105:  Syntax error
  check codepage:
    26:  Active codepage was never set
    27:  Device read codepage error
  prepare codepage:
    27:  Codepage was not found in CPI file
    29:  Could not get codepage info from file (or XMS troubles)
    31:  specified CPI file is damaged (or XMS troubles)
  end prepare codepage:
    31:  INTERNAL ERROR: End prepare without Begin prepare
  select codepage:
    26:  Specified codepage was not found in file
    27:  KEYB failed to change codepage
    29:  Device select codepage failed (or XMS troubles)
    31:  Device select codepage error
  For more information about MODE see:
    https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/
    mode/2015/  OR:
    https://gitlab.com/FreeDOS/base/mode/-/blob/master/DOC/MODE/
    MODE.TXT

Examples:

  mode /status       Shows the status
  mode lpt1 /status  Shows the status of lpt1
  mode com1 /status  Shows the status of COM1
  mode con /status   Shows the status of the con devices
  mode con codepage  Shows the active codepage and other information
                     about the current status of DISPLAY and the
                     codepage buffers.
  mode con codepage refresh   or:
  mode con: codepage refresh
                     Refreshes the active codepage to hardware (in case
                     it has been accidentaly destroyed)
  mode con codepage prepare ((860) C:\FREEDOS\CPI\ega9.cpx)   or:
  mode con: codepage prepare ((860) C:\FREEDOS\CPI\ega9.cpx)
                     Prepares codepage 860 (Portuguese) from the
                     specified file.
                     The format of the files are .cpx.
                     See the CODEPAGE INFORMATION PACK for information
                     about the available codepages and cpi files.
  mode con codepage select=860   or:
  mode con: codepage select=860
                     Activates codepage 860 (Portuguese) which must have
                     been previously prepared with PREPARE.
  mode 40,25         You can write 40 characters per line and have 25
                     rows (go back with 'mode 80').
  Example for AUTOEXEC.BAT/FDAUTO.BAT:
    MODE CON CP PREP=((858) C:\FREEDOS\CPI\EGA.CPX)
    MODE CON CP SEL=858
    REM Codepage 858 was activated

See also:

  chcp
  cpidos
  cpied
  display
  errorlevel/exitcode
  graftabl
  kc
  keyb
  keycode
  keyman
  klib
  kpdos
  listxdef
  mkeyb
  nlsfunc
  xkeyb

  Copyright © 2003 - 2004 Aitor SANTAMARIA MERINO,
  Henrique PERON, Robert Platt, updated 2023 by W. Spiegl.

  This file is derived from the FreeDOS Spec Command HOWTO.
  See the file H2Cpying for copying conditions.