Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 31371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:35:39+00:00 2026-05-10T13:35:39+00:00

Is the ZIP compression that is built into Windows XP/Vista/2003/2008 able to be scripted

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T13:35:40+00:00Added an answer on May 10, 2026 at 1:35 pm

    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 .zip that 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

    Sub NewZip(sPath) 'Create empty Zip File 'Changed by keepITcool Dec-12-2005     If Len(Dir(sPath)) > 0 Then Kill sPath     Open sPath For Output As #1     Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)     Close #1 End Sub   Function bIsBookOpen(ByRef szBookName As String) As Boolean ' Rob Bovey     On Error Resume Next     bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing) End Function   Function Split97(sStr As Variant, sdelim As String) As Variant 'Tom Ogilvy     Split97 = Evaluate('{''' & _                        Application.Substitute(sStr, sdelim, ''',''') & '''}') End Function  Sub Zip_File_Or_Files()     Dim strDate As String, DefPath As String, sFName As String     Dim oApp As Object, iCtr As Long, I As Integer     Dim FName, vArr, FileNameZip      DefPath = Application.DefaultFilePath     If Right(DefPath, 1) <> '\' Then         DefPath = DefPath & '\'     End If      strDate = Format(Now, ' dd-mmm-yy h-mm-ss')     FileNameZip = DefPath & 'MyFilesZip ' & strDate & '.zip'      'Browse to the file(s), use the Ctrl key to select more files     FName = Application.GetOpenFilename(filefilter:='Excel Files (*.xl*), *.xl*', _                     MultiSelect:=True, Title:='Select the files you want to zip')     If IsArray(FName) = False Then         'do nothing     Else         'Create empty Zip File         NewZip (FileNameZip)         Set oApp = CreateObject('Shell.Application')         I = 0         For iCtr = LBound(FName) To UBound(FName)             vArr = Split97(FName(iCtr), '\')             sFName = vArr(UBound(vArr))             If bIsBookOpen(sFName) Then                 MsgBox 'You can't zip a file that is open!' & vbLf & _                        'Please close it and try again: ' & FName(iCtr)             Else                 'Copy the file to the compressed folder                 I = I + 1                 oApp.Namespace(FileNameZip).CopyHere FName(iCtr)                  'Keep script waiting until Compressing is done                 On Error Resume Next                 Do Until oApp.Namespace(FileNameZip).items.Count = I                     Application.Wait (Now + TimeValue('0:00:01'))                 Loop                 On Error GoTo 0             End If         Next iCtr          MsgBox 'You find the zipfile here: ' & FileNameZip     End If End Sub 

    UNZIP

    Sub Unzip1()     Dim FSO As Object     Dim oApp As Object     Dim Fname As Variant     Dim FileNameFolder As Variant     Dim DefPath As String     Dim strDate As String      Fname = Application.GetOpenFilename(filefilter:='Zip Files (*.zip), *.zip', _                                         MultiSelect:=False)     If Fname = False Then         'Do nothing     Else         'Root folder for the new folder.         'You can also use DefPath = 'C:\Users\Ron\test\'         DefPath = Application.DefaultFilePath         If Right(DefPath, 1) <> '\' Then             DefPath = DefPath & '\'         End If          'Create the folder name         strDate = Format(Now, ' dd-mm-yy h-mm-ss')         FileNameFolder = DefPath & 'MyUnzipFolder ' & strDate & '\'          'Make the normal folder in DefPath         MkDir FileNameFolder          'Extract the files into the newly created folder         Set oApp = CreateObject('Shell.Application')          oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(Fname).items          'If you want to extract only one file you can use this:         'oApp.Namespace(FileNameFolder).CopyHere _          'oApp.Namespace(Fname).items.Item('test.txt')          MsgBox 'You find the files here: ' & FileNameFolder          On Error Resume Next         Set FSO = CreateObject('scripting.filesystemobject')         FSO.deletefolder Environ('Temp') & '\Temporary Directory*', True     End If End Sub 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 190k
  • Answers 190k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Problem was with hosting WCF services.I had hosted them on… May 12, 2026 at 5:54 pm
  • Editorial Team
    Editorial Team added an answer Try using jQuery $.post() <script> // ... $('#ajaxFormSubmit').bind('click', function(event) {… May 12, 2026 at 5:54 pm
  • Editorial Team
    Editorial Team added an answer Alternatively, if the template or standard values were locked when… May 12, 2026 at 5:54 pm

Related Questions

I wrote the following Nant script on my Vista dev machine and was pleased
I know there are libraries out there for working with ZIP files . And,
Is there a library in .net that does multithreaded compression of a stream? I'm
How can I create 7-Zip archives from my C# console application? I need to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.