ZIP and UNZIP with VBScript on Windows XP

A

Ayush

[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.
 
G

Guest

Thanks

It's exactly what I was looking for. It is working very well.

Ayush" <"ayushmaan.j[aatt]gmail.com said:
[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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top