『楼 主』:
Config.sys & Autoexec.bat 文件的详细介绍
使用 LLM 解释/回答一下
--------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
格式如下:
[MENU]
MENUITEM=块名,菜单内容
MENUCOLOR=X,Y
MENUDEFAULT=块名,时间值
[块名]
…………
[COMMON]
…………
这是一个多重配置的命令格式,其中[MENU]块是必不可少的,它定义了启动菜单的菜单项及颜色等信息,其它的块大多以某个菜单项的名字来命名,当选中菜单项时则执行与它相应的块里面的语句;[COMMON]为公共项,无论选择哪个菜单项,公共项里面的命令都将被执行。
MENUITEM=SUB_1 系统定义了一个菜单项,格式为:
MENUITEM=块名 菜单内容
块名:当选中此菜单项时,将执行的配置块的名字。
菜单内容:显示启动菜单时,出现在屏幕上的内容。 此项为可选项,指定它则启动显示菜单时只显示它而不显示块名,否则启动菜单上显示的是块名。
MENUCOLOR=15,1定义了启动菜单的前景色和背景色,格式为:MENUCOLOR=X,Y
X:指定菜单中文字的颜色,其值为0~15。
Y:指定菜单中背景颜色,其值为0~15,缺省值为0,即黑色。
MENUDEFAULT=SUB_3,10定义了启动菜单的一个缺省选择项,并设定了一个超时限定值。格式如下:
MENUDEFAULT=块名,时间值
块名:缺省菜单项的块名。
时间值:规定在等待多少秒后如果还未按键,系统将执行缺省菜单项相应的菜单块。
DEVICE=C:\PWindows 98\HIMEM.SYS /TESTMEM:OFF 加载扩展内存管理程序,其中"/TESTMEM:OFF"表示加载扩展内存管理程序时不检测内存。
DEVICE=C:\PWindows 98\EMM386.EXE RAM NOEMS I=B000-B7FF 加载扩充内存管理程序(必须先加载扩展内存管理程序)。"RAM"表示将640K~1024K之间闲余的内存提交给DOS管理,此空间即为UMB(上位内存块),"NOEMS"表示系统不提供任何扩充内存的功能,缺少情况下EMM386管理程序会将扩展内存模拟成扩充内存。"I=B000-B7FF"表示将地址为B000~B7FF(供单色显示器映射ROM用)的32K大小的内存释放成为UMB。
DEVICEHIGH=C:\CDROM\TEAC_CDI.SYS /D:MSCD001 将光驱驱动程序装载入上位内存。注意如果要在DOS下面使用光驱,最好在配置Config.sys前运行一下光驱在DOS下面驱动程序的安装文件,然后将此安装程序在Config.sys和Autoexec.bat两文件中添加的语句记下来,在配置多重启动时把这些语句加进去。因为各类光驱的驱动程序都不尽相同,所以只能这么配置。
LASTDRIVE=Z 指定系统可分配的最后一个驱动器号,其值取A~Z。
DOS=HIGH,UMB表示DOS管理由EMM386.EXE创建的UMB,并将自身的一部分装入HMA(高端内存)。
FILES=96 指定DOS可以同时访问的文件数量。
STACKS=9,512 此命令表示在处理硬件中断时可以动态使用9个512K大小的数据堆栈。
--------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
说明如下:
@ECHO OFF 表示不显示AUTOEXEC. BAT中各行命令语句的内容,前面加上"@"则"ECHO OFF"字符也不显示在屏幕上,否则屏幕上显示"ECHO OFF"。
SET 用于设置、显示或删除DOS环境变量。%PATH%表示取当前系统搜索路径参数。
GOTO %CONFIG% 表示DOS将转到标号为环境变量CONFIG值的语句下面,开始执行下面的语句。
LH MOUSE.COM 表示将鼠标驱动程序加入到上位内存,如果鼠标驱动程序是*.SYS的形式的化,则必须将该驱动程序通过CONFIG. SYS文件加载到上位内存区中,格式为:
DEVICEHIGH=C:\MOUSE\MOUSE. SYS其中"DEVICEHIGH"表示将该设备驱动程序加载到UMB。
LH C:\CDROM\MSCDEX.EXE /D:MSCD-001 将光驱驱动程序装载入上位内存。注意加入此命令前在Config.sys必须加入"DEVI-CEHIGH=C:\CDROM\TEAC_CDI.SYS/D:MS-CD001"语句。
SMARTDRV加载高速磁盘缓存程序。程序加载时如上位内存有剩余空间,它将自动加载到上位内存。为有效地加速系统对磁盘的操作,通过SMARTDRV.EXE在扩展内存中创建磁盘缓存,它存储刚刚使用且以后还要使用的磁盘扇区的数据,因为以后直接从RAM而不是从磁盘中读取数据,所以提高了访问速度。
如果最终调试成功后还可以用文本编辑器打开MSDOS.SYS文件,在文件最后加入一行语句----"BOOTKEYS=0",以禁止使用者使用F4、F5和F8键。也可在Config.sys的第一行(即"[MENU]"的上面)加入如下语句:
SWITCHES=/F/N (启动时的开关选项,"/F"表示启动时跳过2秒钟的"Starting……"等待时间;"/N"表示禁止使用"F5"或"F8"键来跳过启动命令)
注意:Config.sys和Autoexec.bat两个文件中所有的标点符号都必须是西文格式的(如","不能写成","),否则在启动时将出错!
附扩充内存、扩展内存、常规内存、上位内存、高端内存的定义
扩展内存(XMS,EXTENDED MEMO-RY),是主板上0~640K以外的内存。由于DOS早期开发的局限性,只能管理0~640K内的内存段。为了使用640K以外的扩展内存,电脑业形成了一个使用标准,即(Lotus/Intel/Micro-soft/AST)Extended Memory specification(扩展内存使用规范)。MS_DOS所提供的HIMEM .SYS文件即是按此规范编写的扩展内存管理(驱动)程序,通过在启动时加载此管理(驱动)程序,系统即可使用640K以上的内存空间。
扩充内存(EMS,EXPANDED MEMO-RY),是通过加插板卡或通过模拟实现的内存。为了使用640K以上的扩充内存,电脑业形成了一个使用标准,即(Lotus/Intel/Microsoft)Expanded Memory Specification(扩充内存使用规范)。对于加插板卡的扩充内存,必须运行随卡附带的驱动程序;如果要用扩展内存来模拟扩充内存,则需运行MS_DOS提供的EMM386.EXE驱动程序。从EMS和XMS的产生时间来看,EMS要早于XMS,早期的计算机内存都较小,远远满足不了大型软件的运行需要,所以必须通过加插板卡以增加内存,而随着主板、内存等的制造成本的下降,XMS也逐渐取代了EMS,但为了适应早期一些应用程序必须使用EMS的需要(比如以前KOEI出的三国志系列),MS_DOS提供了通过EMM386. EXEGO来利用XMS模拟EMS的的功能。
常规内存始于0KB,结束于640KB,社果没有使用一些内存管理程序的话(在MS_DOS下面,除了HIMEM.SYS、EMM386.EXE之外还有Quarterdeck的QEMM和Qualitas的386MAX等),那么常规内存就是你所能使用的唯一的一种内存,常规内存将被DOS及设备驱动程序和TSR(内存常驻程序)所占用。TSR是装入计算机内存并驻留在那里面的一种程序,而一般的程序往往在使用完毕之后把占用的内存返还给操作系统。
上位内存(UMB,UPPER MEMORY BLOCKS),指640KB到1024KB之间的内存,通常此区域被褚如系统ROM、视频之类所使用。但大多数的计算机的硬件并不使用整个上位内存区,当我们使用了像EMM386这样的内存管理管理程序之后,就可以把一些TSR程序移到这此内存区。
高端内存(HMA,HIGH MEMORY AREA),是1MB内存以上的64KB连续内存空间,它属于扩展内存。换句话说就是指扩展内存的前64K部分。这是内存的一个特殊区域,通常用来将DOS装入高端内存区域内。
--------Config.sys--------
MENUITEM=SUB_1 DOS
MENUITEM=SUB_2 DOS & CDROM
MENUITEM=SUB_3 MS_Windows
MENUCOLOR=15,1
MENUDEFAULT=SUB_3,10
DEVICE=HIMEM.SYS /TESTMEM:OFF
DEVICE=EMM386.EXE RAM NOEMS I=B000-B7FF
LASTDRIVE=Z
DOS=HIGH,UMB
FILES=96
STACKS=9,512
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
LASTDRIVE=Z
The format is as follows:
MENUITEM=block name, menu content
MENUCOLOR=X, Y
MENUDEFAULT=block name, time value
…………
…………
This is a command format for multiple configurations. The 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; 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 ""):
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.
|