请输入您要查询的百科知识:

 

词条 AUTOEXEC.BAT
释义

  1. Usage

  2. Example

  3. Dual-booting DOS and Windows 9x

  4. OS/2

  5. Windows NT

  6. See also

  7. References

  8. Further reading

AUTOEXEC.BAT is a system file that was originally on DOS-type operating systems. It is a plain-text batch file in the root directory of the boot device. The name of the file is an abbreviation of "automatic execution", which describes its function in automatically executing commands on system startup; the filename was coined in response to the 8.3 filename limitations of the FAT file system family.

Usage

AUTOEXEC.BAT is read upon startup by all versions of DOS, including MS-DOS version 7.x as used in Windows 95 and Windows 98. Windows ME only parses environment variables as part of its attempts to reduce legacy dependencies, but this can be worked around.[2]

In Korean versions of MS-DOS/PC DOS 4.01 and higher (except for PC DOS 7 and 2000), if the current country code is set to 82 (for Korea) and no /P:filename is given and no default AUTOEXEC.BAT is found, COMMAND.COM will look for a file named KAUTOEXE.BAT instead in order to ensure that the DBCS frontend drivers will be loaded even without properly set up CONFIG.SYS and AUTOEXEC.BAT files.[3]

Under DOS, the file is executed by the primary copy of the command-line processor (typically COMMAND.COM) once the operating system has booted and the CONFIG.SYS file processing has finished. While DOS by itself provides no means to pass batch file parameters to COMMAND.COM for AUTOEXEC.BAT processing, the alternative command-line processor 4DOS supports a 4DOS.INI AutoExecParams directive and //AutoExecParams= startup option to define such parameters.[4] Under Concurrent DOS, Multiuser DOS and REAL/32, three initial parameters will be passed to either the corresponding STARTxxy.BAT (if it exists) or the generic AUTOEXEC.BAT startup file, %1 holds the virtual console number,[5] %2 the 2-digit terminal number (xx) (with 00 being the main console) and %3 the 1-digit session number (y).[6]

Windows NT and its descendants Windows XP and Windows Vista parse AUTOEXEC.BAT when a user logs on. As with Windows Me, anything other than setting environment variables is ignored.[7] Unlike CONFIG.SYS, the commands in AUTOEXEC.BAT can be entered at the interactive command line interpreter. They are just standard commands that the computer operator wants to be executed automatically whenever the computer is started, and can include other batch files.

AUTOEXEC.BAT is most often used to set environment variables such as keyboard, soundcard, printer, and temporary file locations. It is also used to initiate low level system utilities, such as the following:

  • Virus scanners
  • Disk caching software
  • Mouse drivers
  • Keyboard drivers
  • CD drivers
  • Miscellaneous other drivers

Example

In early versions of DOS, AUTOEXEC.BAT was by default very simple. The DATE and TIME commands were necessary as early PC and XT class machines did not have a battery backed-up real-time clock as default.

@ECHO OFF

CLS

DATE

TIME

VER

In non-US environments, the keyboard driver (like KEYBFR for the French keyboard) was also included. Later versions were often much expanded with numerous third-party device drivers. The following is a basic DOS 5 type AUTOEXEC.BAT configuration, consisting only of essential commands:

@ECHO OFF

PROMPT $P$G

PATH C:\\DOS;C:\\WINDOWS

SET TEMP=C:\\TEMP

SET BLASTER=A220 I7 D1 T2

LH SMARTDRV.EXE

LH DOSKEY

LH MOUSE.COM /Y

This configuration sets common environment variables, loads a disk cache, places common directories into the default PATH, and initializes the DOS mouse / keyboard drivers. The PROMPT command sets the prompt to "C:\\>" (when the working directory is the root of the C drive) instead of simply "C>" (the default prompt, indicating only the working drive and not the directory therein).

In general, device drivers were loaded in CONFIG.SYS, and programs were loaded in the AUTOEXEC.BAT file. Some devices, such as mice, could be loaded either as a device driver in CONFIG.SYS, or as a TSR in AUTOEXEC.BAT, depending upon the manufacturer.[8]

In MS-DOS 6.0 and higher, a DOS boot menu is configurable. This can be of great help to users who wish to have optimized boot configurations for various programs, such as DOS games and Windows.

@ECHO OFF

PROMPT $P$G

PATH C:\\DOS;C:\\WINDOWS

SET TEMP=C:\\TEMP

SET BLASTER=A220 I7 D1 T2

GOTO %CONFIG%

WIN

 LH SMARTDRV.EXE LH MOUSE.COM /Y WIN

GOTO END

XMS

 LH SMARTDRV.EXE LH DOSKEY GOTO END

END

The GOTO %CONFIG% line informs DOS to look up menu entries that were defined within CONFIG.SYS. Then, these profiles are named here and configured with the desired specific drivers and utilities. At the desired end of each specific configuration, a GOTO command redirects DOS to the :END section. Lines after :END will be used by all profiles.

Dual-booting DOS and Windows 9x

When installing Windows 95 over a preexisting DOS/Windows install, CONFIG.SYS and AUTOEXEC.BAT are renamed to CONFIG.DOS and AUTOEXEC.DOS. This is intended to ease dual booting between Windows 9x and DOS. When booting into DOS, they are temporarily renamed CONFIG.SYS and AUTOEXEC.BAT. Backups of the Windows 9x versions are made as .W40 files.

Windows 9x also installs MSDOS.SYS, a configuration file, which will not boot Windows 95/98 if parameterBOOTGUI=0 is loaded, and instead a DOS prompt will appear on the screen (Windows can still be loaded by calling the WIN command (file WIN.COM). This file contains some switches that designate how the system will boot, one of which controls whether or not the system automatically goes into Windows. This "BootGUI" option must be set to "0" in order to boot to a DOS prompt. By doing this, the system's operation essentially becomes that of a DOS/Windows pairing like with earlier Windows versions. Windows can be started as desired by typing WIN at the DOS prompt.

When installing Caldera DR-DOS 7.02 and higher, the Windows version retains the name AUTOEXEC.BAT, while the file used by the DR-DOS COMMAND.COM is named AUTODOS7.BAT, referred to by the startup parameter /P:filename.ext in the SHELL directive. It also differentiates the CONFIG.SYS file by using the name DCONFIG.SYS.[9][10][11]

OS/2

The equivalent to AUTOEXEC.BAT under OS/2 is the OS/2 STARTUP.CMD file, however, genuine DOS sessions booted under OS/2 continue to use AUTOEXEC.BAT.

Windows NT

On Windows NT and its derivatives, Windows 2000, Windows Server 2003 and Windows XP, the equivalent file is called AUTOEXEC.NT and is located in the %SystemRoot%\\system32 directory. The file is not used during the operating system boot process; it is executed when the MS-DOS environment is started, which occurs when a DOS application is loaded.

The AUTOEXEC.BAT file may often be found on Windows NT, in the root directory of the boot drive. Windows only considers the SET and PATH statements which it contains, in order to define environment variables global to all users. Setting environment variables through this file may be interesting if for example MS-DOS is also booted from this drive (this requires that the drive be FAT- formatted) or to keep the variables across a reinstall. This is an exotic usage today so the file usually remains empty. The TweakUI applet from the PowerToys collection allows to control this feature (Parse AUTOEXEC.BAT at logon).

See also

  • IBMBIO.COM
  • IBMDOS.COM
  • IO.SYS
  • MSDOS.SYS
  • COMMAND.COM
  • CONFIG.SYS
  • autorun.inf

References

1. ^{{cite web |author-first=V. |author-last=Ashumov |title=Some features of MS-DOS 8.0 |date=2017 |orig-year=2007 |url=http://www.multiboot.ru/msdos8.htm |access-date=2010-11-21 |dead-url=no |archive-url=https://web.archive.org/web/20101022205112/http://www.multiboot.ru/msdos8.htm |archive-date=2010-10-22}}
2. ^{{cite web |title=System file settings |author-first=Matthias |author-last=Paul |publisher=comp.os.msdos.programmer |date=2001-10-25 |url=https://groups.google.com/d/msg/comp.os.msdos.programmer/OWwTYzBfHWs/G8Wl1FOCfa0J |access-date=2014-08-06 |dead-url=no |archive-url=https://archive.today/20170910164616/https://groups.google.com/forum/%23!msg/comp.os.msdos.programmer/OWwTYzBfHWs/G8Wl1FOCfa0J |archive-date=2017-09-10 |df= }}
3. ^{{cite book |title=4DOS 8.00 online help |author-first1=Hardin |author-last1=Brothers |author-first2=Tom |author-last2=Rawson |author-first3=Rex C. |author-last3=Conn |author-first4=Matthias |author-last4=Paul |author-first5=Charles E. |author-last5=Dye |author-first6=Luchezar I. |author-last6=Georgiev |date=2002-02-27}}
4. ^{{cite book |title=Concurrent DOS Multiuser/Multitasking Operating System - Print Spooler User's Guide |publisher=Digital Research |date=1989-02-01 |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/digitalResearch/concurrent/1172-2005-001_Concurrent_DOS_Print_Spooler_Users_Guide_Feb89.pdf |access-date=2014-08-12 |dead-url=no |archive-url=https://web.archive.org/web/20161105164541/http://bitsavers.informatik.uni-stuttgart.de/pdf/digitalResearch/concurrent/1172-2005-001_Concurrent_DOS_Print_Spooler_Users_Guide_Feb89.pdf |archive-date=2016-11-05}}
5. ^{{cite web |title=FYI - Configuring CSPOOL |publisher=Novell |date=1992-12-29 |id=FYI.M.1901 |url=http://cd.textfiles.com/netwaresl/NOV_INFO/RNW93/10JAN93.MON |access-date=2014-08-12 |dead-url=no |archive-url=https://web.archive.org/web/20161105164756/http://cd.textfiles.com/netwaresl/NOV_INFO/RNW93/10JAN93.MON |archive-date=2016-11-05}}
6. ^{{cite web |title=INFO: Configuring Parsing of the AUTOEXEC.BAT |date=2007-03-20 |id=ID 124551 |edition=1 |publisher=Microsoft |url=http://support.microsoft.com/kb/124551 |access-date=2017-09-10 }}
7. ^{{cite web |title=Mouse Doesn't Work with MS-DOS Shell |publisher=Microsoft |url=http://support.microsoft.com/kb/96706 |dead-url=yes |access-date=2006-10-15 |archive-url=https://web.archive.org/web/20070311095112/http://support.microsoft.com/kb/96706 |archive-date=2007-03-11 |df= }}
8. ^{{cite book |title=DR-DOS 7.02 User Guide - Chapter 1: Introduction to DR-DOS |publisher=Caldera, Inc. |date=1998 |url=http://www.drdos.com/dosdoc/usergeng/01ugch1.htm |access-date=2013-08-10 |dead-url=no |archive-url=https://web.archive.org/web/20161105170240/http://www.drdos.com/dosdoc/usergeng/01ugch1.htm |archive-date=2016-11-05}}
9. ^{{cite book |title=DR-DOS 7.02 User Guide |publisher=Caldera, Inc. |date=1998 |url=http://www.drdos.net/documentation/usergeng/uglontoc.htm |access-date=2013-08-10 |dead-url=yes |archive-url=https://web.archive.org/web/20161105165004/http://www.drdos.net/documentation/usergeng/uglontoc.htm |archive-date=2016-11-05 |df= }}
10. ^{{cite web |title=FYI - Configuring LOADER.COM for Multiple Operating System Boots - Installing DR DOS on NEC DOS 3.3 Partitions |publisher=Novell |date=1993-01-05 |id=FYI.M.1909 |url=http://cd.textfiles.com/netwaresl/NOV_INFO/RNW93/10JAN93.MON |access-date=2014-08-12 |dead-url=no |archive-url=https://web.archive.org/web/20161105165452/http://cd.textfiles.com/netwaresl/NOV_INFO/RNW93/10JAN93.MON |archive-date=2016-11-05}}
[1][2][3][4][5][6][7][8][9][10]
}}

Further reading

  • {{cite web |title=The Windows 98 CONFIG.TXT file - Microsoft Windows 98 README for MS-DOS Config.sys Commands |publisher=Microsoft Corporation |id=ID 232557 |date=2014-06-19 |orig-year=April 1998 |edition=1 |url=http://support.microsoft.com/?kbid=232557 |access-date=2017-09-10 }}
{{DEFAULTSORT:Autoexec.Bat}}

2 : DOS files|Configuration files

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/11 0:52:38