@echo off
rem *** OPEN.BAT opens a given PERCH case without the usual PERCH prompts.
rem *** If the case is available uncompressed, it wil be opened, if it's
rem *** available compressed only, it will be extracted from the archive.
if "%1"=="" goto USAGE
if exist %1.zip goto UNZIP
goto COPYINF
:UNZIP
rem Choice is working since DOS 6.0. Older DOS-version will report an error.
if exist %1.inf choice /c:ycn Extract archive? Yes,Cancel,No?
if errorlevel 3 goto COPYINF
if errorlevel 2 goto END
PKUNZIP.EXE %1.ZIP
if not exist %1.inf goto ERROR1
:COPYINF
if not exist %1.inf goto ERROR2
PERCH "%1" *
echo PERCH: Case '%1' opened.
goto END
:USAGE
echo USAGE: OPEN CASENAME
goto END
:ERROR1 
echo ERROR: Can't open case '%1'!
goto END
:ERROR2
echo ERROR: Case '%1' not found!
:END
