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

:chkd2
if exist %1\disk2.mid goto disk2
echo.
echo  Please insert Disk #2 into %1
echo.
pause
goto chkd2

:disk2

if ".%2" == "./l" goto locked
if ".%2" == "./L" goto locked
@copy %1\c2wacd.rtp c2acad.rtp
goto doacad
:locked
@copy %1\c2wach.rtp c2acad.rtp

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

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

:chkd3
if exist %1\disk3.mid goto disk3
echo.
echo  Please insert Disk #3 into %1
echo.
pause
goto chkd3

:disk3

@copy %1\c2wgrt1.rtp .

:chkd4
if exist %1\disk4.mid goto disk4
echo.
echo  Please insert Disk #4 into %1
echo.
pause
goto chkd4

:disk4

@copy %1\c2wgrt2.rtp .
@copy %1\c2wgads.rtp .
@copy %1\c2wgase1.rtp .

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

:disk5

@copy %1\c2wlrt.rtp .
@copy %1\c2custw.exe .

echo.
echo  Patching the Windows AutoCAD root directory.
echo.
patch /I . c2wgrt1.rtp
if errorlevel 1 goto wininst1
patch /I . c2wgrt2.rtp
if errorlevel 1 goto wininst1
patch /I . c2wlrt.rtp
if not errorlevel 1 goto wininst2

:wininst1
echo.
echo  Patch of Windows AutoCAD root directory failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto wininst3

:wininst2
echo.
echo  Windows AutoCAD root directory successfully patched.
echo.
pause

:wininst3
@del c2wgrt1.rtp
@del c2wgrt2.rtp
@del c2wlrt.rtp
@copy %1\c2wldrv.rtp .
echo.
echo  Patching the Windows AutoCAD device drivers
echo.
patch /I . c2wldrv.rtp
if not errorlevel 1 goto wininst5

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

:wininst5
echo.
echo.
echo  Windows AutoCAD device drivers successfully patched.
echo.
pause

:wininst6
@del c2wldrv.rtp
@copy %1\c2wlsst.rtp .

echo.
echo  Patching the Windows AutoCAD ADS directory
echo.
patch /I . c2wgads.rtp
if not errorlevel 1 goto wininst7

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

:wininst7
echo.
echo  Windows AutoCAD ADS directory successfully patched.
echo.
pause

:wininst8

@del c2wgads.rtp

:chkd6
if exist %1\disk6.mid goto disk6
echo.
echo  Please insert Disk #6 into %1
echo.
pause
goto chkd6

:disk6

@copy %1\c2wgase2.rtp .

echo.
echo  Patching the Windows AutoCAD ASE directory
echo.
patch /I . c2wgase1.rtp
if errorlevel 1 goto wininstA
patch /I . c2wgase2.rtp
if not errorlevel 1 goto wininstB

:wininstA
echo.
echo  Patch of Windows AutoCAD ASE directory failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto wininstC

:wininstB
echo.
echo  Windows AutoCAD ASE directory successfully patched.
echo.
pause

:wininstC
@del c2wgase1.rtp
@del c2wgase2.rtp
@copy %1\c2wgsst.rtp .

echo.
echo  Patching the Windows AutoCAD support, sample and tutorial
echo.
patch /I . c2wgsst.rtp
if errorlevel 1 goto wininstD
patch /I . c2wlsst.rtp
if not errorlevel 1 goto wininstE

:wininstD
echo.
echo  Patch of Windows AutoCAD support, sample and tutorial failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
goto wininstF

:wininstE
echo.
echo  Windows AutoCAD support, sample and tutorial successfully patched.
echo.
pause

:wininstF
@del c2wgsst.rtp
@del c2wlsst.rtp

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

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

:disk7

@copy %1\c2whwl.rtp .

echo.
echo  Patching the Windows hardware-lock specific files
echo.
patch /I . c2whwl.rtp
if not errorlevel 1 goto wininstH

echo.
echo  Patch of Windows hardware-lock files failed!
echo.
echo Press CTRL-C to exit now  --OR--
pause
@del c2whwl.rtp
goto unlocked

:wininstH
@del c2whwl.rtp
echo.
echo  Windows hardware-lock specific files successfully patched.
echo.
pause

:unlocked

echo.
echo  Installing the Windows user-custom files (e.g., acad.mnu)
echo.

c2custw -d

echo  C2 Windows AutoCAD installation completed.
echo.

@del patch.exe
@del c2custw.exe 
goto done

:perror
echo Patch of Windows AutoCAD failed!

:done
if exist c2acad.rtp del c2acad.rtp
