Create a batch file called ZIP.BAT containing the following lines:
Create a batch file called UZIP.BAT containing the following lines:@ECHO OFF
REM *** If no parameters then compress all files into ZIPFILE.ZIP
IF "%1"=="" GOTO NONAME
REM *** If one parameter(filename) then compress all files into filename
IF "%2"=="" GOTO ALL
REM *** Both filename to compress to is given and files to compress ***
PKZIP -a -ex -r -P -whs %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO EXIT
:ALL
PKZIP -a -ex -r -P -whs %1 *.*
GOTO EXIT
:NONAME
PKZIP -a -ex -r -P -whs ZIPFILE.ZIP *.*
:EXIT
@ECHO OFF
REM *** If no parameters then extract all the zip files ***
IF "%1"=="" GOTO ALL
REM *** If only one parameter given then extract to current directory ***
IF "%2"=="" GOTO HERE
REM *** Two or more parameters given, the 1st is the zip file, the 2nd is the destination ***
PKUNZIP.EXE -d %1 -o %2
GOTO EXIT
:HERE
PKUNZIP.EXE -d %1 -o .\
GOTO EXIT
:ALL
PKUNZIP.EXE -d *.ZIP -o .\UZIP\
:EXIT
so in the case I want this to zip my files to a different folder, how do I specify that?
Thank you.
Unless you are actually using MS DOS, then I would suggest that you use 7Zip instead of pkzip / pkunzip.
The ZIP.BAT can take the destination of the zip-file as input argument. This will zip the files in the current directory and place the ZIP file in C:\TEMP: