logo elektroda
logo elektroda
X
logo elektroda

AUTOEXEC.BAT Example for MS-DOS and Windows 98 Startup Script

User question

show me an autoexec.bat example

Artificial Intelligence Response

Direct answer to the question

Here is a simple AUTOEXEC.BAT example:

@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS;C:\UTILS
SET TEMP=C:\TEMP
SET TMP=C:\TEMP
DOSKEY
ECHO System startup complete.

Key points:

  • AUTOEXEC.BAT is a startup batch file used mainly in MS-DOS and Windows 95/98/ME.
  • It typically lives in the root of the boot drive, for example C:\AUTOEXEC.BAT.
  • It is used to:
    • set environment variables,
    • define the executable search path,
    • load utilities and drivers,
    • configure the DOS prompt.

If you want a slightly more realistic legacy example, use this:

@ECHO OFF
REM Basic DOS startup configuration
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS;C:\UTILS
SET TEMP=C:\TEMP
SET TMP=C:\TEMP
REM Sound Blaster settings for old DOS games
SET BLASTER=A220 I5 D1 H5 P330 T6
REM Load useful TSRs/utilities
LH DOSKEY
LH MOUSE.COM
LH SMARTDRV.EXE
ECHO Welcome to DOS.

Detailed problem analysis

AUTOEXEC.BAT is a batch script executed automatically after DOS has booted and after CONFIG.SYS has been processed. Historically, it was part of the standard startup flow for DOS-based systems.

What each line does

@ECHO OFF
  • Prevents commands from being displayed as they run.
  • The @ suppresses display of the ECHO OFF line itself.
PROMPT $P$G
  • Sets the command prompt.
  • $P = current drive and path.
  • $G = > character.
  • Result: a prompt like C:\DOS>.
PATH C:\DOS;C:\WINDOWS;C:\UTILS
  • Defines where DOS should search for executable files.
  • If you type a command that is not in the current directory, DOS checks these folders.
SET TEMP=C:\TEMP
SET TMP=C:\TEMP
  • Sets temporary-file directories for programs that rely on TEMP or TMP.
SET BLASTER=A220 I5 D1 H5 P330 T6
  • Defines Sound Blaster parameters for older DOS software.
  • Typical fields:
    • A220 = I/O base address
    • I5 = IRQ
    • D1 = 8-bit DMA
    • H5 = 16-bit DMA
    • P330 = MIDI port
    • T6 = card type
LH DOSKEY
  • Loads DOSKEY into upper memory, if available.
  • DOSKEY gives command history and macros.
LH MOUSE.COM
  • Loads a mouse driver into upper memory.
LH SMARTDRV.EXE
  • Loads a disk cache utility for faster disk access.

Why LH matters

LH means Load High. It attempts to load the program into upper memory rather than conventional memory. This was important on DOS systems because many applications depended on preserving as much of the first 640 KB as possible.

For LH to work properly, memory support usually had to be configured earlier in CONFIG.SYS, commonly with settings such as:

DOS=HIGH,UMB

and a memory manager.

Relationship with CONFIG.SYS

A useful practical distinction is:

  • CONFIG.SYS

    • loads low-level drivers,
    • configures DOS memory behavior,
    • prepares system services.
  • AUTOEXEC.BAT

    • sets environment variables,
    • starts TSRs and utilities,
    • performs user-level startup tasks.

For example, a CD-ROM driver often required:

  • a .SYS driver in CONFIG.SYS, and then
  • MSCDEX.EXE in AUTOEXEC.BAT.

Example:

LH C:\DOS\MSCDEX.EXE /D:MSCD001 /L:D

That /D:MSCD001 token must match the identifier used by the CD-ROM driver in CONFIG.SYS.


Current information and trends

Although AUTOEXEC.BAT is historically important, it is now mainly relevant in these contexts:

  • Retro DOS systems
  • FreeDOS
  • DOSBox / emulators
  • Industrial or embedded legacy PCs
  • Restoration of old gaming machines

For modern Windows systems based on the NT architecture, AUTOEXEC.BAT is not the normal startup mechanism. If someone is trying to auto-run programs today, the modern equivalents are typically:

  • environment variable settings in system configuration,
  • the Startup folder,
  • Task Scheduler,
  • logon/startup policies.

So if your goal is a real retro DOS or Windows 9x setup, AUTOEXEC.BAT is correct. If your goal is Windows 10/11 startup automation, it is not the right tool.


Supporting explanations and details

Minimal example

If you only want the absolute minimum:

@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS

More practical retro-gaming example

@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\GAMES;C:\SB16
SET TEMP=C:\TEMP
SET BLASTER=A220 I5 D1 H5 P330 T6
SET SOUND=C:\SB16
LH C:\DOS\DOSKEY
LH C:\SB16\CTMOUSE.EXE
LH C:\DOS\SMARTDRV.EXE
ECHO Ready for DOS games.

Conditional example

@ECHO OFF
PATH C:\DOS;C:\WINDOWS
SET TEMP=C:\TEMP
IF EXIST C:\MOUSE\MOUSE.COM LH C:\MOUSE\MOUSE.COM
IF EXIST C:\DOS\SMARTDRV.EXE LH C:\DOS\SMARTDRV.EXE
ECHO Startup finished.

This approach is safer because it avoids errors if a file is missing.

Important correction about comments

In standard DOS batch files, the safest comment style is:

REM This is a comment

You may also see:

:: This is often used as a comment

But REM is the most portable and correct choice. A leading semicolon is not the standard comment syntax for DOS batch files.


Ethical and legal aspects

For this topic, the main concerns are practical rather than ethical, but a few points still matter:

  • Legacy hardware safety
    • Incorrect startup scripts can hang older systems or prevent drivers from loading.
  • Industrial systems
    • Some old production machines still depend on DOS startup files; modifications should be controlled and documented.
  • Software licensing
    • Old DOS drivers and TSR utilities may still have redistribution restrictions.
  • Data integrity
    • Disk caching tools such as SMARTDRV can improve performance, but configuration choices may affect shutdown safety on older systems.

Practical guidelines

Best practices

  • Keep a backup of the original file before editing.
  • Use REM to disable lines during troubleshooting.
  • Add commands one at a time and test after each change.
  • Use full paths for utilities when possible.

Example of a safe edited version

@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS
SET TEMP=C:\TEMP
REM Load utilities only if present
IF EXIST C:\DOS\DOSKEY.COM LH C:\DOS\DOSKEY.COM
IF EXIST C:\MOUSE\MOUSE.COM LH C:\MOUSE\MOUSE.COM
ECHO AUTOEXEC.BAT loaded successfully.

Troubleshooting tips

  • If the system freezes during startup, boot step-by-step if the platform supports it.
  • If LH does not save memory, check CONFIG.SYS for upper-memory support.
  • If a driver fails, verify:
    • the file path,
    • the filename,
    • any matching identifiers shared with CONFIG.SYS.

How to verify it works

After booting, check:

  • PATH by typing:
    PATH
  • environment variables by typing:
    SET
  • available memory by typing:
    MEM

Possible disclaimers or additional notes

  • AUTOEXEC.BAT is primarily a legacy DOS-era mechanism.
  • Modern Windows systems generally do not use it as the main boot startup script.
  • Exact commands depend on:
    • DOS version,
    • installed drivers,
    • sound card,
    • CD-ROM support,
    • memory manager configuration.
  • Some utilities shown in examples, such as SMARTDRV, MSCDEX, or MOUSE.COM, may not exist on your system unless they were installed.

Suggestions for further research

If you want to go deeper, the next useful topics are:

  • CONFIG.SYS and memory management
  • DOS=HIGH,UMB
  • EMM386 and upper memory blocks
  • MSCDEX and CD-ROM support
  • Sound Blaster DOS configuration
  • FreeDOS startup scripting
  • DOSBox startup automation

A good practical exercise is to build:

  1. a minimal AUTOEXEC.BAT,
  2. then add DOSKEY,
  3. then add mouse support,
  4. then verify available memory before and after each change.

Brief summary

Yes—an AUTOEXEC.BAT example can be as simple as:

@ECHO OFF
PROMPT $P$G
PATH C:\DOS;C:\WINDOWS;C:\UTILS
SET TEMP=C:\TEMP
SET TMP=C:\TEMP
DOSKEY

The file is a DOS startup script used to set environment variables, configure the prompt, and load utilities. For more complete legacy systems, it often also loads mouse drivers, disk cache tools, and sound-card settings. On modern Windows, however, AUTOEXEC.BAT is mostly obsolete.

If you want, I can also show you:

  • a gaming DOS AUTOEXEC.BAT,
  • a Windows 98-style version,
  • or an AUTOEXEC.BAT + CONFIG.SYS pair.

Ask additional question

Wait...(2min)
Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.