Background: Use the command line to modify the size of the Windows command-line window and the size of the screen buffer (width and height)
Method: The method is to change the registry.
First of all, you can specify the size of the command-line window directly below the command line, and go to the command line to execute mode, and you can see the following information about the console:
Device State CON:
---------
Line: 300
Columns: 80
Keyboard Speed: 31
Keyboard delay: 1
Code page: 936
This is the size of my default console is 300 * 80, check the use of mode command, with mode/? The change hints for display modes are:
Display mode:mode con[:] [cols=c] [lines=n]
You can then 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 becomes 120*40, which makes it impossible to trace the history of screen printing, which means that mode cannot be set separately for window size and screen buffer size.
If you also specify a window size of 120*40 when you start Cmd.exe, 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 way is to modify the registry , first know that the default CMD command window to save the screen buffer size of the two key values are:
Window size: hkey_current_user\console\windowsize
Screen buffer size: hkey_current_user\console\screenbuffersize
This is denoted by the hexadecimal value, the first four bits of the hexadecimal are high, the last four bits are wide (high * wide), such as:
002a0078 0078 of the decimal is 002a, the decimal is 40, the window size is 40*120
07d00078 0078 of the decimal is the 07d0, the decimal is 2000, the buffer size is 2000*120
The registration table will help you create your two key values windowsize and screenbuffersizeunder hkey_current_user\console\ . Apply these two values to each
Hkey_current_user\console\windowsize
Hkey_current_user\console\screenbuffersize
The next time you go to the command-line window, the size is applied by default
Know the principle, you want to use any tool to modify the registry of the two values, you can be an exported reg file, or use the following two commands to change the window size and screen buffer size to 120*40 and 120*2000:
1 2 |
reg add "HKEY_CURRENT_USER\Console" /t REG_DWORD /v WindowSize /d 0x002a0078 /f
reg add "HKEY_CURRENT_USER\Console" /t REG_DWORD /v ScreenBufferSize /d 0x07d00078 /f
|
Reference: http://unmi.cc/save-windows-command-size/, from Yehuang Unmi Blog
This article is from the "7088733" blog, please be sure to keep this source http://7098733.blog.51cto.com/7088733/1775277
To set the Windows command-line window size and buffer size using the command line