problem using Pkzip in a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
knot22
Posts: 3
Joined: 07 Sep 2011 09:20

problem using Pkzip in a batch file

#1 Post by knot22 » 07 Sep 2011 09:52

Hi,

I am trying to write a batch file which takes all of the Excel files in a folder and zips them into a .zip file in that same folder. Here is the batch file code so far:

Code: Select all

::@echo off
Pkzip -m BOreportsInExcel.zip  *.xls
pause


The code has a pause included so I can read what it's doing. ::@echo off is intentional - so it displays everything it's doing in the window (for now while debugging is occurring).

In the C:\WINDOWS\system32\cmd.exe window the error message says " 'Pkzip' is not recognized as an internal or external command, operable program or batch file." The computer is a PC running Windows XP Professional. What needs to be changed to get this to work?

Thanks, knot22

knot22
Posts: 3
Joined: 07 Sep 2011 09:20

Re: problem using Pkzip in a batch file

#2 Post by knot22 » 07 Sep 2011 11:15

One additional fact that may be pertinent here...
I searched C:\ for a file called pkzip.exe and it did not find one. Perhaps that's why it's not working? If that is the case, is there an alternative way to zip files from a .bat?

Funny enough, when a file is right clicked there is a Send-to, Compressed (zipped) Folder option and that works fine. So, this computer can definitely create zipped files if the user does so manually. I would think there'd be a way to automate this in a .bat.

knot22
Posts: 3
Joined: 07 Sep 2011 09:20

Re: problem using Pkzip in a batch file

#3 Post by knot22 » 08 Sep 2011 08:48

Figured it out. The pkzip wouldn't work for two reasons:
a) this computer uses zip.exe instead of pkzip.exe
b) it was necessary to explicitly state the full file path for zip.exe

The final batch file that worked looked like this:

Code: Select all

@echo off
"C:\Program Files\DesktopAuthority\zip.exe" BOreportsInExcel.zip *.xls

Post Reply