MODE - Window Size and Key Repeat

Maintained on

Sometimes you want a bigger window to read long output, or you want every run of a batch file to start with the same screen size.

The MODE command displays and changes device settings for the console (the Command Prompt screen), such as the number of columns and lines and the keyboard repeat speed.

Check the current settings

Type mode con to display the current state of the console. con is the device name for the console.

mode con
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>mode con
Status for device CON:
----------------------
Lines: 30
Columns: 120
Keyboard rate: 31
Keyboard delay: 1
Code page: 437
C:\users\user>

The output and values vary by environment.

Change the window size

Syntax
MODE CON: COLS=columns LINES=lines

Example

Set the window to 100 columns wide and 30 lines high.

mode con: cols=100 lines=30
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>mode con: cols=100 lines=30
おすすめ書籍※ 広告を含む場合があります
中小企業経営者のためのRPA入門 RPA導入を成功させる方法

中小企業経営者のためのRPA入門 RPA導入を成功させる方法

60分でわかる! AIエージェント 超入門

60分でわかる! AIエージェント 超入門

コマンドラインの黒い画面が怖いんです。

コマンドラインの黒い画面が怖いんです。

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

You can also specify only one of COLS or LINES.

Change
mode con: lines=40

There is also a shorthand that separates the columns and lines with a comma.

Shorthand
mode 100,30
The screen buffer changes to the same size

In the classic console window (conhost), changing the size with mode con also makes the screen buffer (the area that keeps past output) the same size as the window. As a result, the scrollbar disappears and earlier output that has scrolled off the screen can no longer be viewed.

It may not work as expected in Windows Terminal

In Windows Terminal, which is the default terminal from Windows 11 22H2 onward, running mode con may not change the size of the window itself. In that case, resize the window with the mouse or change the terminal settings. The window size can mainly be set in the classic console window (conhost).

There is an upper limit on the size

If you specify a value larger than the monitor resolution or font size allows, you may get an error or a size different from what you expected. Try smaller values first.

Fix the size at the top of a batch file

Put the command at the top of a batch file so that it starts with the same screen size every time.

menu.cmd
@echo off
mode con: cols=80 lines=25
cls
echo ==============================
echo   Menu
echo ==============================
echo   1. Backup
echo   2. Cleanup
echo ==============================
pause

Running cls after changing the size lets the display start from a clean screen.

チェック

Setting the colors and title as well makes a running batch file easier to recognize. See the color / title article for details.

Adjust the key repeat speed

mode con can also set how fast a character repeats when you hold down a key.

Syntax
MODE CON: RATE=rate DELAY=delay
ItemDescription
RATEThe speed at which characters repeat. Range 1 to 32; a larger number is faster
DELAYThe wait before repeating starts. Range 1 to 4; 1 is 0.25 seconds and 4 is 1 second

You must specify both RATE and DELAY at the same time.

mode con: rate=31 delay=1

Check the code page

Run mode con cp /status to check the current code page (character encoding).

mode con cp /status
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>mode con cp /status
Status for device CON:
----------------------
Code page: 437
C:\users\user>

The CHCP command is the usual way to change the code page. See the CHCP article for details.

When changes do not take effect

SymptomMain cause and fix
The window size does not changeYou are running in Windows Terminal. Change it in the settings or try conhost
An error appearsThe value is too large for the monitor or font. Try smaller values
An error after specifying RATE onlyRATE and DELAY must be specified together
MODE is a device settings command

Besides the console described here, MODE can also configure communication settings for serial ports (such as COM1) and printer ports (such as LPT1). However, there are few occasions to use them today.

Summary

TaskCommand
Show current console settingsmode con
Set columns and linesmode con: cols=100 lines=30
Set them with the shorthandmode 100,30
Change only the heightmode con: lines=40
Set the key repeat speedmode con: rate=31 delay=1
Check the code pagemode con cp /status

Practice questions

Practice Problem

Which command sets the Command Prompt window to 100 columns wide and 30 lines high?

Choose one answer.

  1. mode con: width=100 height=30
  2. mode con: cols=100 lines=30
  3. mode size 100 30

Practice Problem

Which statement is correct about changing the key repeat settings with mode con?

Choose one answer.

  1. Specifying only RATE is enough
  2. Specifying only DELAY is enough
  3. You must specify both RATE and DELAY at the same time
#Command Prompt #Batch File #Command Line #mode #Window Size #Command