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 have to change it And the buffer size also wants to change greatly. 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 you can directly modify the system's 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
Keyboard rate: 31
Keyboard delay: 1
Code page: 936
This is my default console size is 2000 * 120, see the use of mode command, with mode /? About the display mode modification prompt is:
Display mode: MODE CON[ ,null,null,3],:] [COLS=c] [LINES=n]
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 The 120*40 you want, but the sad reminder is that the size of the screen buffer has also become 120*40, which makes it impossible to trace the history of screen printing, that is, mode cannot be separate for window size and screen buffer size. Settings.
If you start cmd.exe and specify the window size as 120*40, you can use the parameter /k. The complete 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 know the two key values ​​of the screen buffer size of the default cmd command window for saving the system are:
Window size: HKEY_CURRENT_USERConsoleScreenBufferSize If 120 *40 time value is 002a0078
Screen buffer size: HKEY_CURRENT_USERConsoleWindowSize If 120*2000, the value is 07d00078
This is represented by the hexadecimal value, and the hexadecimal can be added before zero. For 8 bits to understand. The first four digits of hexadecimal are high, the last four digits are wide, such as:
002a0078 0078 decimal is 120, 002a decimal is 40, window size is 120*40
07d00078 00078 has a decimal of 120, 07d0 has a decimal of 2000, and the buffer size is 120*2000.
Because it involves hexadecimal truncation into two parts, it is not meaningful to convert it directly into a decimal number. , such as 002a0078 The decimal number is 2752632. Who knows what this number has to do with 120*40!
If you think this is a lot of trouble, then you can find a way to copy it from elsewhere. Set up your window for direct cmd entry. Window size and screen buffer size, the registry will help you create your two key values ​​WindowSize and ScreenBufferSize under HKEY_CURRENT_USERConsole%SystemRoot%_system32_cmd.exe, and apply these two values ​​to
HKEY_CURRENT_USERConsoleWindowSize
HKEY_CURRENT_USERConsoleScreenBufferSize
On the line, the next time you enter the command line window, this size will be applied by default.
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 separate the window size and screen buffer size Change to 120*40 and 120*2000:
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 the screen resolution of 1280*1024, I prefer to set the command line window size and screen buffer size respectively: 130*42 and 130*2000, the corresponding commands are:
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 No special requirements are required to set these properties separately for the windows corresponding to certain 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