echo on

REM %1 is the where the archive can be found.
REM %2 is where the uncompressed files should go.
REM %3 is where the installation files are located.
REM %4 is the filename of the archive

if "%1" == "" goto exit
if "%2" == "" goto exit
if "%3" == "" goto exit
if "%4" == "" goto exit

echo %1
echo %2
echo %3
echo %4

copy %1%4 %2%4
%3dearj.exe x -& -y %2%4 %2 > %3test.fil
REM
IF errorlevel 8 goto error8
IF errorlevel 7 goto error7
IF errorlevel 6 goto error6
IF errorlevel 5 goto error5
IF errorlevel 4 goto error4
IF errorlevel 3 goto error3
IF errorlevel 2 goto error2
IF errorlevel 1 goto error1
copy %3test.fil %3done.txt
goto exit

:error8
echo [Error] > %3err.ini
echo Error=Memory >> %3err.ini
goto exit

:error7
echo [Error] > %3err.ini
echo Error=Parameter >> %3err.ini
goto exit

:error6
echo [Error] > %3err.ini
echo Error=Open >> %3err.ini
goto exit

:error5
echo [Error] > %3err.ini
echo Error=Full >> %3err.ini
goto exit

:error4
echo [Error] > %3err.ini
echo Error=Security >> %3err.ini
goto exit

:error3
echo [Error] > %3err.ini
echo Error=CRC >> %3err.ini
goto exit

:error2
echo [Error] > %3err.ini
echo Error=Fatal >> %3err.ini
goto exit

:error1
echo [Error] > %3err.ini
echo Error=warning >> %3err.ini
goto exit

:exit

