Is the ZIP compression that is built into Windows XP/Vista/2003/2008 able to be scripted at all? What executable would I have to call from a BAT/CMD file? or is it possible to do it with VBScript?
I realize that this is possible using WinZip, 7-Zip and other external applications, but I’m looking for something that requires no external applications to be installed.
There are VBA methods to zip and unzip using the windows built in compression as well, which should give some insight as to how the system operates. You may be able to build these methods into a scripting language of your choice.
The basic principle is that within windows you can treat a zip file as a directory, and copy into and out of it. So to create a new zip file, you simply make a file with the extension
.zipthat has the right header for an empty zip file. Then you close it, and tell windows you want to copy files into it as though it were another directory.Unzipping is easier – just treat it as a directory.
In case the web pages are lost again, here are a few of the relevant code snippets:
ZIP
UNZIP