Set ZipArgs = WScript.Arguments InputFile = ZipArgs(0) TgtFile = ZipArgs(1) Set objShell = CreateObject("Shell.Application") Set source = objShell.NameSpace(InputFile).Items soucnt = objShell.NameSpace(InputFile).Items.Count CreateObject("Scripting.FileSystemObject").CreateTextFile(TgtFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, Chr(0)) objShell.NameSpace(TgtFile).CopyHere(source) Do Until objShell.NameSpace(TgtFile).Items.Count = soucnt wScript.Sleep 3000 Loop wScript.Sleep 3000
usage: CScript "C:\MyZipDir\xpzip.vbs" "C:\MyZipDir\temp_zip" "C:\MyZipDir\a.zip" Macro to Zip and Unzip Files in MS Windows without Additional External Data Archiving Software