我想将目录的所有文件添加到ZIP文件中。我使用Can you zip a file from the command prompt using ONLY Windows' built-in capability to zip files?下面的代码但是这个VB脚本非常慢。
如何更快地完成此操作?
'Get command-line arguments.
Set objArgs = WScript.Arguments
InputFolder = objArgs(0)
ZipFile = objArgs(1)
'Create empty ZIP file.
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar)
Set objShell = CreateObject("Shell.Application")
Set source = objShell.NameSpace(InputFolder).Items
objShell.NameSpace(ZipFile).CopyHere(source)
'Required!
wScript.Sleep 2000
答案 0 :(得分:-1)
我更喜欢使用批处理文件,这是代码:
@echo off
echo Iam.zip
Move test.txt Iam.zip