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-08-14 00:35
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Detailed Introduction to Config.sys & Autoexec.bat Files View 3,491 Replies 15
Original Poster Posted 2005-08-18 20:00 ·  中国 广东 广州 教育网
初级用户
Credits 21
Posts 1
Joined 2005-08-15 23:24
20-year member
UID 41687
Status Offline
--------Config.sys--------
[MENU]
MENUITEM=SUB_1 DOS
MENUITEM=SUB_2 DOS & CDROM
MENUITEM=SUB_3 MS_Windows
MENUCOLOR=15,1
MENUDEFAULT=SUB_3,10
[SUB_1]
DEVICE=HIMEM.SYS /TESTMEM:OFF
DEVICE=EMM386.EXE RAM NOEMS I=B000-B7FF
LASTDRIVE=Z
DOS=HIGH,UMB
FILES=96
STACKS=9,512
[SUB_2]
DEVICE=HIMEM.SYS /TESTMEM:OFF
DEVICE=EMM386.EXE RAM I=B000-B7FF
DEVICEHIGH=C:\CDROM\TEAC_CDI.SYS /D:MSCD001
LASTDRIVE=Z
DOS=HIGH,UMB
FILES=96
STACKS=9,512
[SUB_3]
[COMMON]
LASTDRIVE=Z
The format is as follows:
[MENU]
MENUITEM=block name, menu content
MENUCOLOR=X, Y
MENUDEFAULT=block name, time value
[block name]
…………
[COMMON]
…………
  This is a command format for multiple configurations. The [MENU] block is essential, which defines the menu items of the boot menu and information such as colors. Most other blocks are mostly named after the name of a certain menu item. When a menu item is selected, the statements in the corresponding block will be executed; [COMMON] is a common item. Regardless of which menu item is selected, the commands in the common item will be executed.

  MENUITEM=SUB_1 The system defines a menu item. The format is:
  MENUITEM=block name menu content
  Block name: When this menu item is selected, the name of the configuration block to be executed.
  Menu content: When displaying the boot menu, the content that appears on the screen. This item is an optional item. If it is specified, only it will be displayed when the boot menu is displayed, and the block name will not be displayed. Otherwise, the block name will be displayed on the boot menu.
  MENUCOLOR=15, 1 defines the foreground color and background color of the boot menu. The format is: MENUCOLOR=X, Y
  X: Specify the color of the text in the menu, and its value is 0-15.
  Y: Specify the background color in the menu, and its value is 0-15. The default value is 0, which is black.
  MENUDEFAULT=SUB_3, 10 defines a default option of the boot menu and sets a timeout limit. The format is as follows:

  MENUDEFAULT=block name, time value
  Block name: The block name of the default menu item.
  Time value: It is stipulated that after waiting for a certain number of seconds, if no key is pressed, the system will execute the menu block corresponding to the default menu item.

  DEVICE=C:\PWindows 98\HIMEM.SYS /TESTMEM:OFF Load the extended memory management program, where "/TESTMEM:OFF" means not to detect memory when loading the extended memory management program.
  DEVICE=C:\PWindows 98\EMM386.EXE RAM NOEMS I=B000-B7FF Load the expanded memory management program (the extended memory management program must be loaded first). "RAM" means that the idle memory between 640K-1024K is submitted to DOS for management, and this space is the UMB (upper memory block). "NOEMS" means that the system does not provide any expanded memory functions. If it is missing, the EMM386 management program will simulate extended memory as expanded memory. "I=B000-B7FF" means that the 32K memory with the address from B000 to B7FF (used for the monochrome display mapping ROM) is released as UMB.

  DEVICEHIGH=C:\CDROM\TEAC_CDI.SYS /D:MSCD001 Load the CD-ROM driver into the upper memory. Note that if you want to use the CD-ROM under DOS, it is best to run the installation file of the CD-ROM driver under DOS before configuring Config.sys, and then record the statements added by this installation program in Config.sys and Autoexec.bat. When configuring multiple boots, add these statements. Because the drivers of various CD-ROMs are all different, this is the only way to configure.

  LASTDRIVE=Z Specify the last drive letter that the system can allocate, and its value is A-Z.
  DOS=HIGH, UMB means that DOS manages the UMB created by EMM386.EXE and loads part of itself into HMA (high memory area).
  FILES=96 Specify the number of files that DOS can access simultaneously.
  STACKS=9, 512 This command means that 9 data stacks of 512K size can be dynamically used when processing hardware interrupts.

--------Autoexec.bat--------
@ECHO OFF
GOTO %CONFIG%
:SUB_1
SET PATH=C:\UCDOS;C:\TOOLS;%PA-TH%
LH C:\TOOLS\MOUSE
SMARTDRV
GOTO END
:SUB_2
SET PATH=C:\UCDOS;C:\TOOLS;%PA-TH%
LH C:\TOOLS\MOUSE
LH C:\CDROM\MSCDEX.EXE /D:MSC-D001
SMARTDRV
GOTO END
:SUB_3
WIN
GOTO END
:END

  Explanation is as follows:

  @ECHO OFF means not to display the content of each command statement in AUTOEXEC. BAT. If "@" is added in front, the characters "ECHO OFF" will not be displayed on the screen. Otherwise, "ECHO OFF" will be displayed on the screen.
  SET is used to set, display or delete DOS environment variables. %PATH% means to get the current system search path parameter.
  GOTO %CONFIG% means that DOS will go to the statement below the label with the value of the environment variable CONFIG and start executing the following statements.
  LH MOUSE.COM means to add the mouse driver to the upper memory. If the mouse driver is in the form of *.SYS, then the driver must be loaded into the upper memory area through the CONFIG. SYS file. The format is:
  DEVICEHIGH=C:\MOUSE\MOUSE. SYS where "DEVICEHIGH" means to load the device driver into UMB.
  LH C:\CDROM\MSCDEX.EXE /D:MSCD-001 Load the CD-ROM driver into the upper memory. Note that the statement "DEVI-CEHIGH=C:\CDROM\TEAC_CDI.SYS/D:MS-CD001" must be added in Config.sys before adding this command.
  SMARTDRV loads the high-speed disk cache program. When the program is loaded, if there is remaining space in the upper memory, it will be automatically loaded into the upper memory. To effectively accelerate the system's operation on the disk, create a disk cache in the extended memory through SMARTDRV.EXE. It stores the data of the disk sectors that have just been used and will be used later. Because it is directly read from RAM instead of from the disk later, the access speed is improved.
If the final debugging is successful, you can also use a text editor to open the MSDOS.SYS file and add a line at the end of the file----"BOOTKEYS=0" to prohibit the user from using the F4, F5 and F8 keys. You can also add the following statement in the first line of Config.sys (that is, above "[MENU]"):
  SWITCHES=/F/N (switch option at startup, "/F" means skip the 2-second "Starting……" waiting time at startup; "/N" means prohibit using the "F5" or "F8" key to skip the startup command)
  Note: All punctuation marks in the two files Config.sys and Autoexec.bat must be in Western format (for example, "," cannot be written as ","), otherwise an error will occur at startup!
  Attachment: Definitions of expanded memory, extended memory, conventional memory, upper memory, and high memory
  Extended memory (XMS, EXTENDED MEMO-RY) is the memory outside 0-640K on the motherboard. Due to the limitations of the early development of DOS, it can only manage the memory segments within 0-640K. In order to use the extended memory outside 640K, the computer industry has formed a standard, namely (Lotus/Intel/Micro-soft/AST) Extended Memory specification (Extended Memory Usage Specification). The HIMEM. SYS file provided by MS_DOS is an extended memory management (driver) program written in accordance with this specification. By loading this management (driver) program at startup, the system can use the memory space above 640K.

  Expanded memory (EMS, EXPANDED MEMO-RY) is memory added by inserting a board or by simulation. In order to use the expanded memory above 640K, the computer industry has formed a standard, namely (Lotus/Intel/Microsoft) Expanded Memory Specification (Expanded Memory Usage Specification). For the expanded memory of the inserted board, the driver provided with the board must be run; if the extended memory is used to simulate the expanded memory, the EMM386.EXE driver provided by MS_DOS must be run. Judging from the generation time of EMS and XMS, EMS is earlier than XMS. The memory of early computers was relatively small, which was far from meeting the operation needs of large software. Therefore, it was necessary to insert a board to increase the memory. With the decrease in the manufacturing cost of motherboards, memory, etc., XMS has gradually replaced EMS. However, in order to meet the needs of some early application programs that must use EMS (such as the Romance of the Three Kingdoms series previously produced by KOEI), MS_DOS provides the function of using XMS to simulate EMS through EMM386. EXEGO.

  Conventional memory starts from 0KB and ends at 640KB. If some memory management programs are not used (under MS_DOS, in addition to HIMEM.SYS, EMM386.EXE, there are also Quarterdeck's QEMM and Qualitas's 386MAX, etc.), then conventional memory is the only memory you can use. Conventional memory will be occupied by DOS, device drivers, and TSR (memory-resident programs). TSR is a program that is loaded into and resides in the computer's memory. Generally, a program often returns the occupied memory to the operating system after it is used.

  Upper memory (UMB, UPPER MEMORY BLOCKS) refers to the memory between 640KB and 1024KB. Usually, this area is used by system ROM, video, etc. However, the hardware of most computers does not use the entire upper memory area. When we use a memory management program like EMM386, we can move some TSR programs to this memory area.
High memory area (HMA, HIGH MEMORY AREA) is a 64KB continuous memory space above 1MB of memory, which belongs to extended memory. In other words, it refers to the first 64K part of extended memory. This is a special area of memory, usually used to load DOS into the high memory area.
Floor 2 Posted 2005-08-18 20:21 ·  IANA 局域网IP(Private-Use)
钻石会员
★★★★★
Credits 10,056
Posts 3,041
Joined 2002-11-11 00:00
23-year member
UID 223
Gender Male
Status Offline
Not bad!
We can also use %config% in autoexec to judge the menu item selected by the user, and execute different statements according to the selection.
简单就是美
Floor 3 Posted 2005-08-19 01:06 ·  中国 广东 佛山 电信
初级用户
Credits 23
Posts 12
Joined 2005-08-19 00:21
20-year member
UID 41776
Status Offline
Why is there no content when I open it with Notepad?
Floor 4 Posted 2005-08-19 09:52 ·  中国 辽宁 鞍山 联通
初级用户
Credits 195
Posts 49
Joined 2005-08-12 12:19
21-year member
UID 41584
Gender Male
From 辽宁
Status Offline
This is very useful for our beginners. Thank you first!
Floor 5 Posted 2005-08-19 12:13 ·  中国 福建 福州 电信
元老会员
★★★
农民
Credits 2,903
Posts 991
Joined 2003-07-23 00:00
23-year member
UID 7391
Gender Male
From 福建省
Status Offline
Originally posted by freeboy1314 at 2005-8-19 01:06 AM:
Why is there no content when I open it with Notepad?



The Windows system no longer relies on autoexec.bat and config.sys. They are now mainly configured by the registry to set up the system operating environment.
艰难奋长戟,万古用一夫

中国DOS联盟 http://www.cn-dos.net 欢迎大家来共同学习
我的MSN&E-Mail cn_archer@hotmail.com QQ 56049418
Floor 6 Posted 2005-08-19 14:48 ·  中国 广东 广州 白云区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
The systems of Win9x/ME still retain Autoexec.bat and Config.sys. But the NT-based systems do not rely on them during startup, but CMD still needs Autoexec.nt and Config.nt for configuration. These two files are located in the %SystemRoot%\system32 directory.
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 7 Posted 2005-12-04 16:27 ·  中国 福建 漳州 电信
初级用户
Credits 170
Posts 27
Joined 2005-02-27 00:00
21-year member
UID 36552
Gender Male
Status Offline
This is very useful for our beginners, thank you first!
Floor 8 Posted 2005-12-04 20:00 ·  中国 浙江 衢州 电信
银牌会员
★★★
Credits 1,270
Posts 548
Joined 2004-05-31 00:00
22-year member
UID 25754
Gender Male
Status Offline
Floor 9 Posted 2005-12-16 08:56 ·  中国 浙江 绍兴 中移铁通
新手上路
Credits 8
Posts 4
Joined 2005-11-14 17:09
20-year member
UID 45239
Gender Male
Status Offline
Great! Very impressive. Thanks...
Floor 10 Posted 2005-12-17 15:43 ·  中国 广东 广州 白云区 电信
初级用户
★★
Credits 152
Posts 74
Joined 2005-12-01 23:06
20-year member
UID 46314
Status Offline
Thanks
Floor 11 Posted 2006-01-02 16:37 ·  中国 江苏 苏州 吴江区 电信
初级用户
★★
Credits 125
Posts 72
Joined 2005-09-13 06:10
20-year member
UID 42467
Status Offline
Thanks
Floor 12 Posted 2006-01-03 17:34 ·  中国 上海 鹏博士宽带
初级用户
Credits 52
Posts 26
Joined 2006-01-03 16:47
20-year member
UID 48376
Status Offline
Long time no see the introduction of multi - configuration~~~

Really nostalgic~~~

Floor 13 Posted 2006-01-11 23:24 ·  中国 广东 深圳 福田区 电信
新手上路
Credits 10
Posts 5
Joined 2006-01-11 22:41
20-year member
UID 48829
Status Offline
Haven't made a MENU menu for a long time, classic!
Floor 14 Posted 2006-01-11 23:38 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
21-year member
UID 41046
Gender Male
Status Offline
Originally posted by kro1999 at 2006-1-11 23:24:
Haven't made a MENU menu for a long time, classic!


Yeah, it seems like 11 years...
欢迎造访DOS的小屋!
http://risky.ik8.com
Floor 15 Posted 2006-01-26 00:38 ·  中国 山东 烟台 蓬莱区 联通
初级用户
Credits 30
Posts 15
Joined 2006-01-25 22:37
20-year member
UID 49525
Gender Male
Status Offline
Thanks
Forum Jump: