中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-26 20:15
47,812 topics / 349,912 posts / today 2 new / 48,264 members
其它操作系统综合讨论区 » Question: How to use a program to change the properties of the Windows command prompt window
Printable Version  1,322 / 3
Floor1 seraph5186 Posted 2009-02-04 11:59
新手上路 Posts 4 Credits 8
The properties of the Windows command prompt window can be changed by clicking Properties from the upper-left corner of the window to bring up the properties panel. But because I often run scripts, and there is also a lot of information displayed on the screen, sometimes it goes on for many screens. Now I want to use a script to set the properties of the Windows command prompt window. How can I change them? Permanent changes would be best. As far as I know, mode con can change the width and height, and color can change the colors, but they can only be written into a program, and the changes are not permanent either. But the most critical thing is that I don't know how to change the buffer. I hope the experts can enlighten me, many thanks



————————————————————————————————
Moved from DOS Troubleshooting & Problem Discussion (Answer Room)
Obviously posted in the wrong section. Since this is a forum newbie, no penalty will be given for now; please pay attention in the future.
——Administrator
————————————————————————————————
Floor2 seraph5186 Posted 2009-02-04 12:40
新手上路 Posts 4 Credits 8
Found the answer, already solved
Floor3 523066680 Posted 2009-02-04 18:54
银牌会员 Posts 1,133 Credits 2,362
How?
Floor4 HAT Posted 2009-02-04 18:57
版主 Posts 5,017 Credits 9,023
Modify the registry
1. Default settings:
HKEY_CURRENT_USER\Console

2. Custom settings:


3. Keys and values:
"WindowPosition"=dword:00640104
"CodePage"=dword:000003a8
"FontSize"=dword:00100008
"FontFamily"=dword:00000030
"FontWeight"=dword:00000190
"HistoryNoDup"=dword:00000000
"FullScreen"=dword:00000000
"ScreenColors"=dword:000000ce
"ScreenBufferSize"=dword:12c0050

4. Meaning of the key values:
All key values are expressed in hexadecimal
Window position-----WindowPosition---the high 4 digits are the top, the low 4 digits are the left.
For example, 00640104 means 64H=100 from the top edge of the screen, 104H=260 from the left edge of the screen
Font size----------FontSize---------the high 4 digits are the character height, the low 4 digits are the character width
For example, 00100008 means font width×height=08H×10H=8×16
Fullscreen--------FullScreen-------0: window 1: fullscreen (WindowPosition is invalid at this time)
Window size-------WindowSize-------the high 4 digits are the height, the low 4 digits are the width
Default 00190050, meaning height 19H=25 lines, width 50H=80 columns
Buffer size-------ScreenBufferSize-the high 4 digits are the height, the low 4 digits are the width
Default 012c0050, meaning height 12cH=300 lines, width 50H=80 columns
Font color--------ScreenColors-----the low 2 digits are the same as the font color value in the color setting
Font type---------FontFamily-------36: NSimSun 30: raster font
Current code page-CodePage---------default 3a8H=936: ANSI/OEM-Simplified Chinese GBK
Discard old copies-HistoryNoDup-----0: do not discard 1: discard old copies

5. Relationship between custom and default:
The system first looks for the relevant settings in custom; if there are none in custom, it then looks in default.
That is, custom has higher priority than default.

6. Set window properties in a batch file
set rr="HKCU\Console\%%SystemRoot%%_system32_cmd.exe"
reg delete %rr% /f>nul
reg add %rr% /v "WindowPosition" /t REG_DWORD /d 0x00640104 /f>nul
reg add %rr% /v "WindowSize" /t REG_DWORD /d 0x00190050 /f>nul
reg add %rr% /v "ScreenBufferSize" /t REG_DWORD /d 0x00190050 /f>nul
reg add %rr% /v "FullScreen" /t REG_DWORD /d 0x00000001 /f>nul
reg add %rr% /v "FontSize" /t REG_DWORD /d 0x00100008 /f>nul

7. Font sizes:
(1) Raster font (smaller)
3×5-------00050003
5×8-------00080005
6×12------000c0006
6×13------000d0006
8×16------00100008
8×18------00120008
10×20-----0014000a
10×22-----0016000a
12×27-----001b000c
(2) NSimSun (larger)
6----00060000---3*7
8----00080000---4*9
10---000a0000---5*11
12---000c0000---6*14
14---000e0000---7*16
16---00100000---8*18
18---00120000---9*21
20---00140000---10*23
24---00180000---12*27
28---001c0000---14*32
36---00240000---18*41
72---00480000---36*82
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023