Link to home
Start Free TrialLog in
Avatar of james henderson
james hendersonFlag for United States of America

asked on

read contents of zip file using vbscript

I would like to read the contents of a zip file using vbscript, listing the folders, subfolders, and files just like reading the contents of a normal folder under Windows, but without having to unzip the file.  Is this possible?
Avatar of Shift-3
Shift-3
Flag of United States of America image

Paste the script below into a text file with a .vbs extension.  Customize the value of the strFile variable with the location of the zip file.  Running it will list the contents of the root level of the file.

I'm still working on listing the contents of subfolders.


strFile = "c:\filename.zip"
 
Set objApp = CreateObject( "Shell.Application" )
Set objContents = objApp.NameSpace(strFile).Items()
 
For Each objItem in objContents
    WScript.Echo objItem.Name
Next

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of james henderson

ASKER

Thanks for your  help.  This is exactly what I need.