CMD Simulator
System Informationmode

MODE Command Guide - Configure System Devices in Windows

Master the mode command to configure console display, serial ports, and device settings in Windows Command Prompt. Syntax, examples, and troubleshooting tips.

Rojan Acharya··Updated Mar 29, 2026
Share

The mode command is a Windows Command Prompt utility that configures system devices including the console (Command Prompt window), serial communication ports (COM ports), and parallel printer ports (LPT ports). It sets display dimensions, baud rates, parity settings, and other device parameters from the command line.

Whether you're resizing the Command Prompt window for better readability, configuring serial port settings for embedded device communication, adjusting code page settings for international character support, or scripting console display parameters in batch files, mode provides precise control over system device configuration that no other single command offers. System administrators, developers, and hardware engineers rely on this command for console customization, serial communication setup, and device configuration automation.

This comprehensive guide covers mode command syntax, all operational modes (console, COM port, device status), practical examples for common scenarios, troubleshooting device configuration issues, related system commands, and frequently asked questions. By the end, you'll confidently configure system devices from the command line for console customization, serial communication, and device management tasks.

What Is the Mode Command?

The mode command has existed since MS-DOS and remains a versatile system configuration utility in modern Windows. It serves three primary functions:

  • Console configuration – Set the number of columns and rows (lines) displayed in the Command Prompt window, controlling the buffer width and visible area
  • Serial port configuration – Configure baud rate, parity, data bits, stop bits, and flow control for COM ports used in serial communication
  • Device status display – Show the current configuration of console, COM ports, and other system devices

Unlike GUI-based settings, mode allows command-line and scripted device configuration, making it essential for batch file automation, remote administration, and environments where graphical interfaces are unavailable. The command works in Command Prompt (CMD), Windows Terminal, and batch files across all Windows versions.

Mode is available in all Windows editions including Windows 11, Windows 10, Windows 8, Windows 7, and Windows Server. It does not require administrator privileges for console configuration but may need elevation for serial port changes on some systems.

Important: The mode con command affects only the current console session. Changes are not persistent—they revert when the Command Prompt window is closed. To make changes permanent, include mode commands in startup batch files or Windows Terminal settings.

Mode Command Syntax

The mode command has several forms depending on the target device:

Console Configuration

mode con[:] [cols=c] [lines=n]

Serial Port Configuration

mode comN[:] [baud=b] [parity=p] [data=d] [stop=s] [to={on|off}] [xon={on|off}] [odsr={on|off}] [octs={on|off}] [dtr={on|off|hs}] [rts={on|off|hs|tg}] [idsr={on|off}]

Device Status Display

mode [device] [/status]

Code Page Configuration

mode con[:] cp select=yyy

Parameters and Switches

ParameterDescription
conRefers to the console (Command Prompt window) device
cols=cNumber of characters (columns) per line (width). Range: 1–9999
lines=nNumber of lines (rows) visible in the console. Range: 1–9999
comNSerial port number (COM1, COM2, COM3, etc.)
baud=bBaud rate: 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200
parity=pParity checking: n (none), e (even), o (odd), m (mark), s (space)
data=dNumber of data bits per character: 5, 6, 7, or 8
stop=sNumber of stop bits: 1, 1.5, or 2
to={on|off}Infinite timeout processing (on = never time out)
xon={on|off}XON/XOFF software flow control
odsr={on|off}Output handshaking using DSR (Data Set Ready)
octs={on|off}Output handshaking using CTS (Clear To Send)
dtr={on|off|hs}DTR (Data Terminal Ready) signal control
rts={on|off|hs|tg}RTS (Request To Send) signal control
cp select=yyySelect code page number for the console
/statusDisplay current configuration of the specified device

Console Configuration (mode con)

Setting Console Width and Height

The most common use of the mode command is resizing the Command Prompt window:

mode con cols=120 lines=40

This sets the console to 120 characters wide and 40 rows tall. The window and buffer sizes adjust to accommodate these dimensions.

Column (cols) considerations:

  • Default width is typically 80 or 120 columns
  • Wider consoles (120-200 columns) improve readability for commands with long output (e.g., netstat -ano, driverquery /v)
  • Very wide values (300+) are useful for logging but make the window extend beyond the screen

Line (lines) considerations:

  • Default height is typically 25 or 30 rows
  • More lines reduce the need to scroll up for command output
  • Very large values (1000+) set the screen buffer height, allowing extensive scroll-back

Setting Only Width

Set the console width without changing the height:

mode con cols=150

Setting Only Height

Set the console height without changing the width:

mode con lines=50

Checking Current Console Configuration

Display the current console settings:

mode con

Expected output:

Status for device CON:
----------------------
    Lines:          30
    Columns:        120
    Keyboard rate:  31
    Keyboard delay: 1
    Code page:      437

This shows lines, columns, keyboard repeat rate, keyboard delay, and active code page.

Serial Port Configuration (mode com)

Basic COM Port Setup

Configure COM1 for standard serial communication:

mode com1 baud=9600 parity=n data=8 stop=1

This is the most common serial configuration (9600 8N1), used by many embedded devices, microcontrollers (Arduino), GPS receivers, and industrial equipment.

High-Speed Serial Configuration

Configure COM1 for faster communication:

mode com1 baud=19200 parity=n data=8 stop=1

Higher baud rates support faster data transfer but require both ends of the connection to match settings exactly.

Configure with Hardware Flow Control

Enable CTS/RTS hardware flow control for reliable communication:

mode com1 baud=9600 parity=n data=8 stop=1 octs=on rts=hs

Hardware flow control prevents data loss during fast transfers by using dedicated signal lines to manage data flow between devices.

Check COM Port Status

Display the current configuration of a serial port:

mode com1

Expected output:

Status for device COM1:
-----------------------
    Baud:            9600
    Parity:          None
    Data Bits:       8
    Stop Bits:       1
    Timeout:         OFF
    XON/XOFF:        OFF
    CTS handshaking: OFF
    DSR handshaking: OFF
    DSR sensitivity:  OFF
    DTR circuit:      ON
    RTS circuit:      ON

Display All Device Status

Show the status of all configured devices:

mode

This lists the configuration of the console (CON) and all active COM and LPT ports on the system.

Practical Mode Command Examples

Resize Console for Wide Output

Set a wide console for commands like netstat -ano or wmic that produce wide tabular output:

mode con cols=200 lines=50

This creates a spacious console window that displays wide tables without text wrapping, significantly improving readability for network diagnostics and system queries.

Create a Compact Console Window

Set a small, focused console window for monitoring scripts:

mode con cols=80 lines=15

Useful for small monitoring windows that run continuous scripts (like ping or network monitors) without consuming excessive screen space.

Configure Arduino Serial Connection

Set up COM3 for Arduino communication at the standard baud rate:

mode com3 baud=9600 parity=n data=8 stop=1

Arduino boards typically communicate at 9600 baud with 8 data bits, no parity, and 1 stop bit (8N1). After configuration, use type COM3 to read data or echo data > COM3 to send data.

Configure Industrial Equipment Connection

Set up a COM port for legacy industrial equipment:

mode com1 baud=2400 parity=e data=7 stop=2

Older industrial devices (PLCs, scales, barcode scanners) often use slower baud rates with even parity and 7 data bits. Match the device documentation exactly.

Set Up Serial Communication with Software Flow Control

Enable XON/XOFF for data flow management:

mode com1 baud=9600 parity=n data=8 stop=1 xon=on

XON/XOFF flow control uses control characters (Ctrl+S to pause, Ctrl+Q to resume) sent within the data stream. Simpler than hardware flow control but cannot be used with binary data.

Change Console Code Page

Switch the console to UTF-8 code page for international character display:

mode con cp select=65001

Code page 65001 is UTF-8, supporting characters from all languages. Common code pages: 437 (US English), 850 (Western European), 1252 (Windows Latin), 65001 (UTF-8).

Set Console Size in Batch File Header

Standard batch file header that configures the console before running scripts:

@echo off
title System Monitor
mode con cols=120 lines=40
color 0A

This creates a properly sized, titled console window with green text on a black background for monitoring scripts.

Configure DTR for Modem Communication

Set DTR handshaking for modem connections:

mode com1 baud=9600 parity=n data=8 stop=1 dtr=hs

DTR handshaking mode automatically manages the Data Terminal Ready signal based on the communication state. Used with modems and modem-like devices.

Common Use Cases for the Mode Command

  1. Customizing Command Prompt window size – Use mode con cols=120 lines=40 to set a comfortable working size for administration tasks. Essential for commands that produce wide output like netstat, wmic, and driverquery.

  2. Batch file console configuration – Include mode con at the beginning of batch files to ensure consistent display dimensions regardless of the user's default console settings.

  3. Serial device communication – Configure COM ports for connecting to embedded systems (Arduino, Raspberry Pi), industrial equipment (PLCs, sensors), GPS modules, and legacy hardware that uses RS-232 serial communication.

  4. Console monitoring dashboards – Create compact or full-screen console windows for running monitoring scripts that display real-time system status, network statistics, or application logs.

  5. International character support – Change the console code page with mode con cp select=65001 (UTF-8) to display characters from non-Latin scripts in multilingual environments.

  6. Debugging serial communication – Use mode com1 to verify current port settings match the target device's requirements. Mismatched baud rate or parity settings are the most common serial communication failures.

  7. Scripted device configuration – Automate COM port setup in login scripts or batch files for workstations connected to serial peripherals (barcode scanners, receipt printers, label printers).

  8. Creating wide-format log viewers – Set mode con cols=300 for viewing log files with long lines. Prevents text wrapping that makes log analysis difficult.

  9. Kiosk and digital signage console setup – Configure specific console dimensions for kiosk applications that run in Command Prompt windows as part of unattended display systems.

  10. Testing serial port availability – Run mode com1 to check if a COM port exists and is accessible. Error messages indicate the port is not available or in use by another application.

  11. Legacy application support – Some older Windows applications expect specific console dimensions (80×25 was the DOS standard). Use mode to set exact dimensions for backward compatibility.

  12. Remote administration via serial console – Configure COM ports on servers for out-of-band management through serial console connections, enabling administration when network access is unavailable.

Tips and Best Practices

  1. Use mode con in batch files – Always set console dimensions at the beginning of complex batch scripts to ensure consistent display across different machines and user configurations.

  2. Match serial settings exactly – Both ends of a serial connection must use identical baud rate, parity, data bits, and stop bits. Even one mismatched parameter causes communication failure.

  3. Start with 9600 8N1 – When communicating with an unknown serial device, start with the most common configuration: baud=9600 parity=n data=8 stop=1. Many devices default to these settings.

  4. Check available COM ports – Use mode without parameters to list all available COM ports and their current status before configuring.

  5. Console changes are session-only – Mode con settings reset when the console window closes. For persistent changes, add mode commands to startup scripts or configure Windows Terminal settings.json.

  6. Consider Windows Terminal – For modern console customization, Windows Terminal provides persistent column/row settings through its settings.json. Use mode for scripted or temporary changes.

  7. Use code page 65001 for UTF-8 – When working with international text or Unicode content, mode con cp select=65001 combined with chcp 65001 ensures proper character display.

  8. Don't exceed screen resolution – Setting cols and lines beyond your monitor's resolution creates a window larger than the screen. Use reasonable values based on your display.

  9. Flow control for reliability – Enable hardware flow control (octs=on rts=hs) for high-speed or long-running serial transfers to prevent data loss from buffer overflows.

  10. Verify changes with mode – After setting parameters, run mode con or mode com1 to verify the changes took effect. Some parameter combinations may be rejected silently.

  11. Use timeout for serial reads – Enable timeout (to=on) when reading from COM ports in scripts to prevent indefinite hangs when the device doesn't respond.

  12. Document serial configurations – Keep a record of COM port settings for each connected device. Include baud rate, parity, data bits, stop bits, and flow control in device documentation.

Troubleshooting Common Issues

Console Doesn't Resize

Problem: mode con cols=120 lines=40 runs without error but the console window doesn't change size.

Cause: The screen buffer size is larger than the window size, or another application (ConEmu, cmder) is managing the console window and overriding mode settings.

Solution:

  • Use the native Windows Command Prompt (cmd.exe) rather than third-party console hosts
  • Right-click the title bar → Properties → Layout tab to verify buffer and window dimensions
  • In Windows Terminal, edit settings.json for persistent size changes instead of using mode
  • Ensure the requested dimensions don't exceed the screen resolution limits

Prevention: Use mode for temporary scripted changes. Use application settings for persistent configuration.

"Invalid parameter" for COM Port

Problem: mode com1 baud=9600 returns "Invalid parameter" or similar error.

Cause: The COM port doesn't exist, is in use by another application, or the parameter syntax has a typo. USB-to-serial adapters may assign unexpected COM port numbers.

Solution:

  • Run mode without parameters to list available COM ports
  • Check Device Manager for the correct COM port number (USB serial adapters often use COM3+ instead of COM1)
  • Close other applications (PuTTY, HyperTerminal, Arduino IDE) that may be using the port
  • Verify syntax: parameters use = not : (e.g., baud=9600 not baud:9600)

Prevention: Always check available ports with mode first. Note the COM port number assigned to USB serial adapters.

Serial Communication Garbled Output

Problem: Data received from a serial device appears as random characters or garbage text.

Cause: Mismatched serial settings between the computer and the device. The most common culprit is incorrect baud rate, followed by wrong parity or data bits settings.

Solution:

  • Verify the device's serial settings in its manual or configuration menu
  • Ensure every parameter matches: mode com1 baud=9600 parity=n data=8 stop=1
  • Try common baud rates if the device settings are unknown: 9600, 115200, 19200, 2400
  • Check if the device expects hardware flow control (CTS/RTS) that isn't configured
  • Verify the cable is correct (null modem vs. straight-through for the connection type)

Prevention: Document serial settings for every connected device. Use a labeled cable for each connection.

"Illegal device name" Error

Problem: Mode reports "Illegal device name" when trying to configure a device.

Cause: The device name is misspelled, doesn't exist on the system, or the colon after the device name is missing.

Solution:

  • Use the correct device name: con (console), com1-com9 (serial ports), lpt1-lpt3 (parallel ports)
  • Include the colon after COM port names: mode com1: (though the colon is optional in modern Windows)
  • Verify the device exists with mode (no parameters) to list all available devices

Prevention: Use mode without parameters to list valid device names before configuring.

Mode Changes Lost After System Restart

Problem: COM port or console settings revert to defaults after restarting Windows.

Cause: Mode changes are session-only and not stored persistently. Console settings reset when the window closes, and COM port settings reset when the system restarts.

Solution:

  • Include mode commands in startup batch files or login scripts
  • For console settings, modify Windows Terminal settings.json or CMD Properties
  • For COM port settings, configure the port through Device Manager for persistent settings
  • Create a scheduled task that runs at login to apply mode configurations

Prevention: Use persistent configuration methods (registry, Device Manager, Windows Terminal settings) for settings that must survive restarts.

Related Commands

chcp – Change Code Page

While mode con cp select=yyy sets the console code page, chcp provides a shorter syntax for the same operation. chcp 65001 switches to UTF-8, and chcp alone displays the current code page. Both commands change the active console code page for character encoding.

When to use chcp: Quick code page changes. Use mode for combined console configuration (dims + code page in one command).

title – Set Console Window Title

title changes the text displayed in the Command Prompt title bar. Combined with mode, it configures both the appearance (title) and dimensions (cols/lines) of the console window for professional batch file interfaces.

When to use title: Setting descriptive console window titles for monitoring scripts, batch files, and administrative tools.

color – Set Console Colors

color sets the foreground and background colors of the Command Prompt window. Combined with mode and title, it creates fully customized console environments for batch file applications.

When to use color: Customizing console appearance for monitoring dashboards, warning messages (red background), or application branding.

powercfg – Power Configuration

powercfg manages power settings including serial port power management. COM ports may stop responding if Windows puts them into low-power sleep mode. Use powercfg /change standby-timeout-ac 0 to prevent sleep or configure USB selective suspend.

When to use powercfg: When COM port connections drop intermittently due to Windows power management suspending the USB-to-serial adapter.

cls – Clear Console Screen

cls clears the console screen without changing its dimensions. Often used with mode in batch scripts: mode con cols=120 lines=40 followed by cls provides a clean, properly-sized console.

When to use cls: After changing console dimensions to clear any display artifacts from the resize operation.

Frequently Asked Questions

What does the mode command do?

The mode command configures system devices in Windows Command Prompt. Its primary uses are setting console window dimensions (cols and lines), configuring serial COM port settings (baud rate, parity, data bits, stop bits), and displaying the current configuration of system devices.

How do I change the Command Prompt window size?

Use mode con cols=120 lines=40 to set the console to 120 characters wide and 40 rows tall. Replace the numbers with your desired dimensions. This change is temporary—it resets when the console window closes. For persistent changes, modify Windows Terminal settings or CMD Properties.

How do I configure a COM port in CMD?

Use mode com1 baud=9600 parity=n data=8 stop=1 to configure COM1 with standard settings (9600 baud, no parity, 8 data bits, 1 stop bit). Replace com1 with your COM port number and adjust parameters to match your device's requirements. Run mode alone to list available ports.

What is the default console size in CMD?

The default Command Prompt window is typically 80 columns by 25 or 30 rows, depending on the Windows version and display settings. Run mode con to check the current dimensions. The screen buffer may be larger than the visible window, allowing scrollback.

How do I check the status of a COM port?

Run mode com1 (replace 1 with your port number) to display the current configuration including baud rate, parity, data bits, stop bits, and flow control settings. Run mode without parameters to list all available COM ports and their status.

Are mode command changes permanent?

No, mode changes are session-only. Console dimensions reset when the CMD window closes, and COM port settings reset on system restart. For persistent changes, add mode commands to startup scripts, modify Windows Terminal settings.json, or configure COM ports through Device Manager.

What is the maximum console size?

The mode command accepts cols and lines values up to 9999, but practical limits depend on your display resolution, font size, and graphics adapter. Values exceeding the screen dimensions create a window with scrollbars. Typical practical maximums are 200-300 columns and 50-80 lines.

How do I set the console to UTF-8?

Use mode con cp select=65001 or the shorter chcp 65001 to switch the console to UTF-8 encoding. This enables display of international characters, emoji, and non-Latin scripts. Some fonts (like Consolas or Cascadia Code) support more Unicode characters than others.

Can mode configure USB serial adapters?

Yes, USB-to-serial adapters appear as COM ports in Windows (usually COM3 or higher). Check Device Manager → Ports (COM & LPT) for the assigned port number, then use mode com3 baud=9600 parity=n data=8 stop=1 (replace com3 with the correct port).

What baud rates does mode support?

The mode command supports standard baud rates: 110, 150, 300, 600, 1200, 2400, 4800, 9600, and 19200. For higher baud rates (38400, 57600, 115200), use Device Manager or the stty equivalent in PowerShell. The 9600 baud rate is the most commonly used default.

How do I reset mode settings to default?

Close and reopen the Command Prompt window to reset console settings. For COM ports, disconnect and reconnect the device, or restart the computer. There is no specific mode /reset command—changes are inherently temporary and reset on session/system restart.

Can I use mode in PowerShell?

Yes, mode works in PowerShell as an external command (mode.com). Use mode con cols=120 lines=40 for console sizing and mode com1 baud=9600 parity=n data=8 stop=1 for serial configuration. PowerShell also offers [System.IO.Ports.SerialPort] for more advanced serial programming.

Quick Reference Card

CommandPurposeExample Use Case
mode con cols=120 lines=40Set console dimensionsStandard widescreen console
mode con cols=200 lines=50Wide console for long outputView netstat, wmic tables
mode con cols=80 lines=25DOS-standard console sizeLegacy application compatibility
mode com1 baud=9600 parity=n data=8 stop=1Configure COM1 (9600 8N1)Arduino, serial device setup
mode com1 baud=19200 parity=n data=8 stop=1High-speed serialFast data transfer
mode com1Check COM1 statusVerify serial configuration
mode conCheck console statusView current dimensions
modeList all device statusAudit all system devices
mode con cp select=65001Set UTF-8 code pageInternational character support
mode com1 baud=9600 octs=on rts=hsSerial with flow controlReliable data transfer

Try the Mode Command in Our Simulator

Practice the mode command safely in our Windows Command Simulator. No installation required—run mode con cols=120 lines=40, test COM port configuration syntax, and explore all parameters in your browser without affecting your actual system devices. Perfect for learning, IT training, and testing command syntax before configuring production equipment.

Visit the Commands Reference for a full list of supported Windows CMD commands, including system configuration tools like color, title, and set.

Explore related command guides: cls for clearing the console, prompt for customizing the command line, and doskey for command-line macros.

Check out our About page to learn more about Windows Command Simulator and our mission to make Windows command-line tools accessible to everyone.

Summary

The mode command is a versatile Windows utility for configuring system devices from the command line. Its three primary functions—console display configuration, serial port setup, and device status reporting—make it essential for batch file scripting, serial communication, and console customization.

For console configuration, mode con cols=120 lines=40 sets the Command Prompt window dimensions. For serial communication, mode com1 baud=9600 parity=n data=8 stop=1 configures COM ports with the standard 9600 8N1 settings used by most embedded devices. Running mode without parameters displays the status of all system devices.

Common use cases range from resizing Command Prompt windows for better readability and scripting batch file interfaces to configuring serial connections for Arduino boards, industrial equipment, and legacy hardware. The command also handles code page changes for international character support with mode con cp select=65001.

Remember that mode changes are session-only—they reset when the console closes or the system restarts. For persistent configuration, add mode commands to startup scripts, modify Windows Terminal settings, or configure serial ports through Device Manager. Always match serial settings exactly on both ends of the connection to prevent garbled communication.