China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-26 17:03
中国DOS联盟论坛 » 其它操作系统综合讨论区 » Question: How to use a program to change the properties of the Windows command prompt window View 1,221 Replies 3
Original Poster Posted 2009-02-04 11:59 ·  IANA 局域网IP(Private-Use)
新手上路
Credits 8
Posts 4
Joined 2009-01-08 15:14
17-year member
UID 136123
Gender Male
Status Offline
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
————————————————————————————————
Floor 2 Posted 2009-02-04 12:40 ·  IANA 局域网IP(Private-Use)
新手上路
Credits 8
Posts 4
Joined 2009-01-08 15:14
17-year member
UID 136123
Gender Male
Status Offline
Found the answer, already solved
Floor 3 Posted 2009-02-04 18:54 ·  中国 广东 广州 电信
银牌会员
★★★★
SuperCleaner
Credits 2,362
Posts 1,133
Joined 2008-02-02 21:36
18-year member
UID 110072
Gender Male
Status Offline
Floor 4 Posted 2009-02-04 18:57 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
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
Forum Jump: