我有创建压缩文件夹的代码,下面的代码用于压缩文件
$ZipArchive = @ScriptDir & "\test.zip"; Put here the full path and name ame of archive you would like to create
$AddFile = @ScriptDir & "\zip.au3"; Put here the the File you would like to compress in the zip
$AddFile2 = "c:\config.sys"; Take another File ...
$oShell = ObjCreate("Shell.Application"); 创建 s shell 对象
if IsObj($oShell) then
InitZip($ZipArchive); Create an emtpy zip file with header
$oDir = $oShell.NameSpace($ZipArchive); Use the zip file as an "Folder"
$oDir.CopyHere ($AddFile); Copy a file in the "Zip Folder"
$oDir.CopyHere ($AddFile2); Copy a second file
sleep (500); Give the Objekt a litte bit time to work
else
Msgbox (0,"Error","Error creating Object.")
endif
Func InitZip ($zip_path_name)
$init_zipString= Chr(80) & Chr(75) & Chr(5) & Chr(6);Create the Header String
for $n =1 to 18;the
$init_zipString= $init_zipString & Chr(0);Header
next
$file =FileOpen($zip_path_name,2)
FileWrite($file,$init_zipString);Write the string in a file
FileClose($file)
EndFunc