How to set the Windows default command line window size and buffer size

  
                                    

How to set the Windows default command line window size and buffer size

Windows command line cmd window system default size (80*40) for the current screen configuration has not kept up with the times, we always I want to change it bigger, and the buffer size is also going to change a lot. Simply modifying the display size and buffer size for the current Windows command line window is as simple as right-clicking the command line window title, changing the screen buffer and window size in the properties, the system will remember the same command line window as the current title. Your settings, such as C:Windowssystem32cmd.exe. But often you will open a command line window with different titles, such as Tomat. At this time, it is the default 80*40 window size, and you have to change it.

So can you directly modify the system default cmd window and its buffer size, and then refer to it after encountering a new title. The way is to change the registry.

First look at the size of the command line window directly on the command line, go to the command line to execute mode, you can see the information about the console is as follows:

Status for Device CON:

----------------------

Lines: 2000

Columns: 120< Br>

Keyboard rate: 31

Keyboard delay: 1

Code page: 936

This is my default console size is 2000 * 120, To view the use of the mode command, use mode /? The modification hint about the display mode is:

Display mode: MODE CON[:] [COLS=c] [LINES=n]

Then you can Use the command mode con cols=120 lines=40 or mode 120,40 to modify the window size to 120*40.

The window size is changed to 120*40 you want, but the sad reminder is the screen. The size of the buffer also becomes 120*40, which prevents you from tracing the history of screen printing, which means that mode cannot be set separately for window size and screen buffer size.

If you specify cmd.exe with a window size of 120*40, you can use the parameter /k. The full command is:

cmd /k "mode con:cols=120 lines= 40" or cmd /k "mode 120,40"

The ultimate solution is to modify the registry. First, you need to know the two key values ​​of the screen buffer size of the default cmd command window for saving the system:

Window Size: HKEY_CURRENT_USERConsoleScreenBufferSize If 120*40, the value is 002a0078

Screen Buffer Size: HKEY_CURRENT_USERConsoleWindowSize If the value is 120*2000, 07d00078

This is the sixteen used. The hexadecimal value can be used to understand that hexadecimal can be pre-added to zero to fill in 8 bits. The first four digits of hexadecimal are high, and the last four digits are wide, such as:

002a0078 The decimal of 0078 is 120, the decimal of 002a is 40, the window size is 120*40

The decimal of 07d00078 00078 is 120, the decimal of 07d0 is 2000, and the buffer size is 120*2000

Because it involves hexadecimal truncation into two parts, so If you want to convert directly to a decimal number, it doesn't make much sense. For example, the decimal number of 002a0078 is 2752632. Who knows how this number has anything to do with 120*40!

If you think this corresponds to the trouble , then find a way to copy from elsewhere, set the window size and screen buffer size for the window that directly commands cmd to enter, the registry will help you create two of your two under HKEY_CURRENT_USERConsole%SystemRoot%_system32_cmd.exe The key values ​​WindowSize and ScreenBufferSize are applied to

HKEY_CURRENT_USERConsoleWindowSize

HKEY_CURRENT_USERConsoleScreenBufferSize

, the next time you enter the command line window, the default will be Apply this size.

Know the principle, what tools you want to use to modify the registry will follow you, you can export the reg file, or use the following two commands to size the window and screen buffer The area size is changed to 120*40 and 120*2000 respectively:

reg add "HKEY_CURRENT_USERConsole" /t REG_DWORD /v WindowSize /d 0x002a0078 /f

reg add "HKEY_CURRENT_USERConsole" /t REG_DWORD /v ScreenBufferSize /d 0x07d00078 /f

At 1280*1024 screen resolution, I prefer to set the command line window size and screen buffer size: 130*42 and 130*2000, respectively. The command is:

reg add "HKEY_CURRENT_USERConsole" /t REG_DWORD /v WindowSize /d 0x002a0082 /f

reg add "HKEY_CURRENT_USERConsole" /t REG_DWORD /v ScreenBufferSize /d 07d00082 /f

I like to use the quick edit mode of the cmd window, and open it by the way, with the command:

reg add "HKEY_CURRENT_USERConsole" /t REG_DWORD /v QuickEdit /d 0x0000001 /f

After writing down the first three reg commands, OK, there is no special requirement to set these properties separately for the window corresponding to some titles. For example, you don't need to set the window's property for C:Windowssystem32cmd.exe to delete the registry key HKEY_CURRENT_USERConsole%SystemRoot%_system32_cmd.exe.

Copyright © Windows knowledge All Rights Reserved