[Alain Arsenault] wrote-:
Hi
Anyone know how to zip and unzip files with vbscript on windows XP ?
To UnZip files-
'----------------------------
pathToZipFile="C:\index.zip"
extractTo="C:\"
set sa = CreateObject("Shell.Application")
set filesInzip=sa.NameSpace(pathToZipFile).items
sa.NameSpace(extractTo).CopyHere(filesInzip)
'----------------------------
To Zip files-
'----------------------------
FolderToZip = "C:\CygWin"
zipFile = "C:\some.zip"
set sa = CreateObject("Shell.Application")
Set zip= sa.NameSpace(zipFile)
Set Fol=sa.NameSpace(FolderToZip)
zip.CopyHere(Fol.Items)
WScript.Sleep 2000 ' increase this if the folder is large
'----------------------------
Good Luck, Ayush.