中国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-14 02:12
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Detailed Introduction to Config.sys & Autoexec.bat Files
Printable Version  3,496 / 15
Floor1 yuanbao Posted 2005-08-18 20:00
初级用户 Posts 1 Credits 21
--------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.
Floor2 Michael Posted 2005-08-18 20:21
钻石会员 Posts 3,041 Credits 10,056
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.
Floor3 freeboy1314 Posted 2005-08-19 01:06
初级用户 Posts 12 Credits 23
Why is there no content when I open it with Notepad?
Floor4 cadle Posted 2005-08-19 09:52
初级用户 Posts 49 Credits 195 From 辽宁
This is very useful for our beginners. Thank you first!
Floor5 cn_archer Posted 2005-08-19 12:13
元老会员 Posts 991 Credits 2,903 From 福建省
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.
Floor6 JonePeng Posted 2005-08-19 14:48
金牌会员 Posts 1,883 Credits 4,562 From 广东广州
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.
Floor7 home Posted 2005-12-04 16:27
初级用户 Posts 27 Credits 170
This is very useful for our beginners, thank you first!
Floor8 weilong888 Posted 2005-12-04 20:00
银牌会员 Posts 548 Credits 1,270
Floor9 yhsyhs101101 Posted 2005-12-16 08:56
新手上路 Posts 4 Credits 8
Great! Very impressive. Thanks...
Floor10 flamey Posted 2005-12-17 15:43
初级用户 Posts 74 Credits 152
Thanks
Floor11 lfdjssz Posted 2006-01-02 16:37
初级用户 Posts 72 Credits 125
Thanks
Floor12 zhri1980 Posted 2006-01-03 17:34
初级用户 Posts 26 Credits 52
Long time no see the introduction of multi - configuration~~~

Really nostalgic~~~

Floor13 kro1999 Posted 2006-01-11 23:24
新手上路 Posts 5 Credits 10
Haven't made a MENU menu for a long time, classic!
Floor14 fdsiuha Posted 2006-01-11 23:38
高级用户 Posts 302 Credits 587
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...
Floor15 lockingxp Posted 2006-01-26 00:38
初级用户 Posts 15 Credits 30
Thanks
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023