我从此博客中获取了以下脚本 pzip.vbs 来压缩文件。但出现错误pzip.vbs(10, 3) Microsoft VBScript runtime error: Object required: 'zip'
。脚本中有什么问题吗?它还能用于 4GB 大小的文件吗?
命令行:CScript pzip.vbs targetfile.zp.dat sourcefile.dat
pzip.vbs中的脚本:
Set objArgs = WScript.Arguments
ZipFile = objArgs(0)
' Create empty ZIP file and open for adding
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set zip = CreateObject("Shell.Application").NameSpace(ZipFile)
' Add all files/directories to the .zip file
For i = 1 To objArgs.count-1
zip.CopyHere(objArgs(i))
WScript.Sleep 60000 'REQUIRED!! (Depending on file/dir size)
Next