並不確切地知道你的意思CLIENTNAME什麼(計算機名?),但這應該讓你開始,你可以自己添加其他否則你會留下鏽蝕8>)
zip = "c:\myzip.zip"
source = "G:\script\zip"
set fso = createObject("Scripting.FileSystemObject")
set shell = createObject("shell.application")
'make empty zip
set file = fso.CreateTextFile(zip, True)
file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
file.close
set objFolder = shell.NameSpace(source)
set oZip = shell.NameSpace(zip)
if not oZip is nothing then
'add files to zip
oZip.CopyHere objFolder
wait_until_zipped(zip)
oZip.CopyHere "c:\ship.xml"
wait_until_zipped(zip)
'rename the zip to tar
fso.MoveFile zip, "c:\myzip.tar"
end if
'cleanup
set oZip = Nothing
set shell = Nothing
set fso = Nothing
function wait_until_zipped(zip)
set handle = fso.getFile(zip)
do
wscript.sleep 500
max = handle.size
loop while handle.size > max
end function