@ECHO OFF
set _xarc_=pkunzip
set _xarc_=UNZIP

if not exist chkem.exe          goto err
if not exist hack_s.zip         goto err
if not exist qdastro.zip        goto err

echo.
echo ::: Here is current directory :
echo.
CD
echo.
echo ::: Now, please hit (almost) any key to unpack QDTOOLS.ZIP here,
echo ::: or hit Ctrl-C or Ctrl-Break in order to abort installation.
echo.
pause
echo.

chkem -x
if errorlevel 32 goto hack
if errorlevel 16 goto hack

REM DIRBAT *.zip "md $n$_cd $n$_$p_xarc_$p ..\$n$_cd.."

md FILE
cd FILE
%_xarc_% ..\FILE
cd..
md FILE_S
cd FILE_S
%_xarc_% ..\FILE_S
cd..
md TEXT
cd TEXT
%_xarc_% ..\TEXT
cd..
md TEXT_S
cd TEXT_S
%_xarc_% ..\TEXT_S
cd..
md VIDEO
cd VIDEO
%_xarc_% ..\VIDEO
cd..
md VIDEO_S
cd VIDEO_S
%_xarc_% ..\VIDEO_S
cd..
md MISC
cd MISC
%_xarc_% ..\MISC
cd..
md MISC_S
cd MISC_S
%_xarc_% ..\MISC_S
cd..
md HACK
cd HACK
%_xarc_% ..\HACK
cd..
md HACK_S
cd HACK_S
%_xarc_% ..\HACK_S
cd..
md FUN
cd FUN
%_xarc_% ..\FUN
cd..
md FUN_S
cd FUN_S
%_xarc_% ..\FUN_S
cd..
md WIN31
cd WIN31
%_xarc_% ..\WIN31
cd..
md M2LIB_S
cd M2LIB_S
%_xarc_% ..\M2LIB_S
cd..
md PBLIB_S
cd PBLIB_S
%_xarc_% ..\PBLIB_S
cd..
md WIN31_S
cd WIN31_S
%_xarc_% ..\WIN31_S
cd..
md BATDOS
cd BATDOS
%_xarc_% ..\BATDOS
cd..
md BAT98SE
cd BAT98SE
%_xarc_% ..\BAT98SE
cd..
md BATXP
cd BATXP
%_xarc_% ..\BATXP
cd..
md QDASTRO
cd QDASTRO
%_xarc_% ..\QDASTRO
cd..

if not exist m2lib_s\readme.txt goto err
if not exist qdastro\readme.txt goto err

rem silly XP cmd.exe forces us to remove ampersand !

echo.
echo QD Tools package seem properly unpacked. Please check README.TXT file.
goto end

:hack
echo.
echo ****************************************************************************
echo *                                                                          *
echo * WARNING ! QDTOOLS.ZIP archive seems to have been tampered or corrupted ! *
echo *                                                                          *
echo ****************************************************************************
echo.
echo Do _NOT_ trust anything from this archive ! Do try and locate another copy !
echo.
goto end

:err
echo.
echo QD Tools main archive do not seem to be properly unpacked :
echo please check DOS %_xarc_% unzipper is available and in path.
echo.
echo Note you may edit this batch to change _xarc_ environment variable value.
echo.
goto end

:end
set _xarc_=