Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to unzip files using Shell.application

Windows Scripting

How to unzip files using Shell.application

by  Mike Gagnon  Posted    (Edited  )
Note this requires Windows XP or higher

This was posted on a French newsgroup by Thierry (unknown last name)

Zip files

* The directories must be valid

Code:
cFileZip = "C:\temp2\D401001F.ZIP"
cSource = "c:\temp1\"
strtofile(chr(0x50)+chr(0x4B)+chr(0x05)+chr(0x06)+replicate(chr(0),18),cFileZip)
o=CREATEOBJECT("shell.application")
FOR EACH ofile IN o.NameSpace(cSource).items
   o.NameSpace(cFileZip).copyhere(ofile)
ENDFOR


Unzip files

Code:
cFileZip = "C:\temp\D401001F.ZIP"
cDestination = "c:\temp\"

o=CREATEOBJECT("shell.application")
FOR EACH ofile IN o.NameSpace(cFileZip).items
    o.NameSpace(cDestination).copyhere(ofile)
ENDFOR


Mike Gagnon
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top