@copy %1\readc2a.txt .
@copy %1\patch.exe .
@copy %1\c2custd.exe .

if ".%2" == "./l" goto locked
if ".%2" == "./L" goto locked

@copy %1\c2dacd.rtp c2acad.rtp
goto doacad

:locked
@copy %1\c2dach.rtp c2acad.rtp

:doacad
echo.
echo  Patching the DOS AutoCAD executable.
echo.
patch . c2acad.rtp
if errorlevel 1 goto perror

@del c2acad.rtp
echo.
echo  DOS AutoCAD executable successfully patched.
echo.
pause

:chkd5
if exist %1\disk5.mid goto disk5
echo.
echo  Please insert Disk #5 into %1
echo.
pause
goto chkd5

:disk5

@copy %1\c2dldrv.rtp .

echo.
echo  Patching the DOS AutoCAD device drivers.
echo.
patch /I . c2dldrv.rtp
if not errorlevel 1 goto dosinst1

echo.
echo  Patch of DOS AutoCAD device drivers failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto dosinst2

:dosinst1

echo.
echo.
echo  DOS AutoCAD device drivers successfully patched.
echo.
pause

:dosinst2
@del c2dldrv.rtp
@copy %1\c2dlrt.rtp .
@copy %1\c2dlsst.rtp .

:chkd7
if exist %1\disk7.mid goto disk7
echo.
echo  Please insert Disk #7 into %1
echo.
pause
goto chkd7

:disk7

@copy %1\c2dgrt.rtp .
@copy %1\c2dhwl.rtp .

echo.
echo  Patching the DOS AutoCAD root directory.
echo.
patch /I . c2dgrt.rtp
if errorlevel 1 goto dosinst3
patch /I . c2dlrt.rtp
if not errorlevel 1 goto dosinst4

:dosinst3
@del c2dgrt.rtp
@del c2dlrt.rtp
echo.
echo  Patch of DOS AutoCAD root directory failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto chkd8

:dosinst4
@del c2dgrt.rtp
@del c2dlrt.rtp

echo.
echo  DOS AutoCAD root directory successfully patched.
echo.
pause

:chkd8
if exist %1\disk8.mid goto disk8
echo.
echo  Please insert Disk #8 into %1
echo.
pause
goto chkd8

:disk8

@copy %1\c2dgads.rtp .

echo.
echo  Patching the DOS AutoCAD ADS directory.
echo.
patch /I . c2dgads.rtp
if not errorlevel 1 goto dosinst5

echo.
echo  Patch of DOS AutoCAD ADS directory failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto dosinst6

:dosinst5
echo.
echo  DOS AutoCAD ADS directory successfully patched.
echo.
pause

:dosinst6
@del c2dgads.rtp
@copy %1\c2dgase.rtp .

echo.
echo  Patching the DOS AutoCAD ASE directory.
echo.
patch /I . c2dgase.rtp
if not errorlevel 1 goto dosinst7

echo.
echo  Patch of DOS AutoCAD ASE directory failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto dosinst8


:dosinst7
echo.
echo  DOS AutoCAD ASE directory successfully patched.
echo.
pause

:dosinst8
@del c2dgase.rtp
@copy %1\c2dgsst.rtp .

echo.
echo  Patching the DOS AutoCAD support, sample and tutorial.
echo.
patch /I . c2dgsst.rtp
if errorlevel 1 goto dosinst9
patch /I . c2dlsst.rtp
if not errorlevel 1 goto dosinstA

:dosinst9
@del c2dgsst.rtp
@del c2dlsst.rtp
echo.
echo  Patch of DOS AutoCAD support, sample and tutorial failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto dosinstB

:dosinstA
@del c2dgsst.rtp
@del c2dlsst.rtp

echo.
echo  DOS AutoCAD support, sample and tutorial successfully patched.
echo.
pause

:dosinstB
if ".%2" == "./u" goto unlocked
if ".%2" == "./U" goto unlocked

echo.
echo  Patching the DOS hardware-lock specific files.
echo.
patch /I . c2dhwl.rtp
if not errorlevel 1 goto dosinstC
@del c2dhwl.rtp

echo.
echo  Patch of DOS hardware-lock specific files failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto unlocked

:dosinstC
@del c2dhwl.rtp
echo.
echo  DOS hardware-lock specific files successfully patched.
echo.
pause

:unlocked
echo.
echo  Installing the DOS user-custom files (e.g., acad.mnu).
echo.

c2custd -d

echo  C2 DOS AutoCAD installation completed.
echo.

@del patch.exe
@del c2custd.exe 
goto done

:perror
echo Patch of DOS AutoCAD failed!

:done
