# creating a zipfile and adding a file to it from a \[vb\] script on windows 2000.  How?

**URL:** <https://boards.straightdope.com/t/creating-a-zipfile-and-adding-a-file-to-it-from-a-vb-script-on-windows-2000-how/440101>\
**Category:** Factual Questions\
**Created:** [March 4, 2008, 10:25pm UTC](https://boards.straightdope.com/t/creating-a-zipfile-and-adding-a-file-to-it-from-a-vb-script-on-windows-2000-how/440101 "2008-03-04T22:25:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lobsang](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lobsang/32/4067_2.png) [@Lobsang](https://boards.straightdope.com/u/Lobsang)\
**Post date:** [March 4, 2008, 10:25pm UTC](https://boards.straightdope.com/t/creating-a-zipfile-and-adding-a-file-to-it-from-a-vb-script-on-windows-2000-how/440101/1 "2008-03-04T22:25:15Z")

</div>

Hi peeps.

Another programmy one for you.

I am trying to write a script which will run as a scheduled task on a windows 2000 server which has an unlicenced copy of winzip on it.

I know how to use built in zipping in a script on XP but this isn’t XP.

I have script to use winzip but this copy of winzip isn’t registered so I can’t use it from script.

I’d prefer to avoid putting anything on there (such as a freeware zipper) as I don’t really have permission to.  
So do I Have any options left?

---

<div class="post-metadata">

**Author:** ![Number](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/number/32/242_2.png) [@Number](https://boards.straightdope.com/u/Number)\
**Post date:** [March 5, 2008, 5:42am UTC](https://boards.straightdope.com/t/creating-a-zipfile-and-adding-a-file-to-it-from-a-vb-script-on-windows-2000-how/440101/2 "2008-03-05T05:42:23Z")

</div>

I’m fairly certain there is no way to edit zip files with vbscript alone.

My initial inclination would be to use [7-Zip](http://www.7-zip.org/) as it’s free, open source, and supports command line switches. However, your injunction against third-party software doesn’t leave many choices.

Does it have to be a zip file? Windows 2000 includes the program [Makecab.exe](http://support.microsoft.com/kb/198038) which can create .cab archives from the command line. These should be adequate for most of the functions that zip files serve, though the compression is not as good.

---

<div class="post-metadata">

**Author:** ![PuddingCat](https://avatars.discourse-cdn.com/v4/letter/p/b4bc9f/32.png) [@PuddingCat](https://boards.straightdope.com/u/PuddingCat)\
**Post date:** [March 5, 2008, 1:09pm UTC](https://boards.straightdope.com/t/creating-a-zipfile-and-adding-a-file-to-it-from-a-vb-script-on-windows-2000-how/440101/3 "2008-03-05T13:09:50Z")

</div>

Hi Lobsang,

If I were doing this I’d look for a COM interface for the Zip API. I’ve had a quick scan and there doesn’t appear to be one. My second option would be doing a

CreateObject Shell  
and a oShell.Execute “c:\windows\zip.exe -params files.src file.zip”

But that requires a zip exe. I’ve not got a w2k box here so I don’t know how that would go. Do you have the command line winzip installed? If it doesn’t prompt for confirmation that it’s no longer free, you should be able to do option 2 with it.

It would be way easier if you could put an exe on the box, or at least have one which is drive mappable to from the host. Then just use a UNC path in the oShell.Execute.

tim
