sel*_*tas 5 compression batch-file batch-processing
我在压缩批处理文件中的目录或文件时遇到问题。我该怎么做,有人可以帮我解决这个问题吗?
谢谢
在SuperUser 的帖子上有一个类似问题的很好的解决方案,我已将其复制粘贴在下面。
CScript zip.vbs C:\test3 C:\someArchive.zip
其中 zip.vbs 包含以下内容
'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
Run Code Online (Sandbox Code Playgroud)