Hi!
Damit gehts:
Since Windows already knows how to deal with zip files to some extent you
might want to try the following. No external programs are needed. Believe it
or not the wscript.sleep at the end is important to make this work
correctly.
Code:
Const FOF_CREATEPROGRESSDLG = &H0&
Const MyZip = "C:\..\MyZipFile.zip"
Const File1 = "C:\..\File1.txt"
Const File2 = "C:\..\File2.txt"
Const MyDest = "C:\scratch"
'-------------- create empty zip file ---------
'Create the basis of a zip file.
CreateObject("Scripting.FileSystemObject") _
.CreateTextFile(MyZip, True) _
.Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
'-------------- zip ---------------------------
'get ready to add files to zip
With CreateObject("Shell.Application")
'add files
.NameSpace(MyZip).CopyHere File1, FOF_CREATEPROGRESSDLG
.NameSpace(MyZip).CopyHere File2
End With
wScript.Sleep 1000
Der Code ist nicht von mir, aber ich habe das bereits getestet. Aber vorsicht, die Windows ZIP Funktion kann nur max 2GB verarbeiten. Ich bin deshalb trozdem auf Winzip und dessen Commandlineversion umgestiegen.
CU
Chris