@echo off
echo Welcome to FreeDOS (http://www.freedos.org)!

REM if clean booting, skip loading CDEx, etc.
if [%config%]==[3] GOTO END

REM else error if CD-ROM driver not loaded!
if NOT exist \dev\FDCD0001 goto error_nocdd
echo Loading CD-ROM extensions ...
shsucdx.exe /d:FDCD0001

REM If you are having problems and own another DOS, you may try its cdex, e.g.
REM mscdex.exe /d:FDCD0001
if [%config%]==[0] GOTO ee

:begin
REM locate DOS drive letter for CD-ROM with FreeDOS CD in it
call FINDCD.BAT
if [%cdrom%]==[NONE] goto error
if [%cdrom%]==[] goto error

REM Enable support for End User programs (not included with FreeDOS)
call config\cfg.bat

REM Perform installation 
REM (note only thing happened was locating cdrom-disk and drive
REM  and establishing which End User programs if any are available.)
%cdrom%
CD FREEDOS
CD AUTORUN
AUTORUN.BAT
GOTO END

:ee
if not exist GAMES\MSWEEP.COM GOTO begin
echo Easter Egg :-) Entertainment courtesy Dave Dunfield
echo Free for noncommercial use, used with permission in this distribution.
if exist GAMES\MSWEEP.COM GAMES\MSWEEP.COM
GOTO END

:error_nocdd
echo Error! Either a CD-ROM driver was not loaded, failed to load, or
echo was loaded with a device name other than FDCD0001.
echo Please make appropriate corrections and try again.  Thanks.
GOTO END

:error
echo No drive found with FreeDOS on it.  Installation Aborted!
echo If the FreeDOS CD is not yet in the drive, please insert
echo it now then change to the CD drive and run \FREEDOS\AUTORUN\AUTORUN.BAT
GOTO END

:END
