用于压缩文件夹的批处理代码?

时间:2014-03-07 04:25:30

标签: batch-file zip

我希望能够创建一个批处理脚本来压缩命令中指定的目录。然后我想称之为info.zip。任何帮助都会很精彩!感谢。

2 个答案:

答案 0 :(得分:0)

你可以使用7zip,它可以从命令行中调用很多参数。你可以找到一些很好的例子here

答案 1 :(得分:0)

请尝试使用此编辑软件。

Dim fso, winShell, MyTarget, MySource, file
Set fso = CreateObject("Scripting.FileSystemObject")
Set winShell = createObject("shell.application")


MyTarget = Wscript.Arguments.Item(0)
MySource = Wscript.Arguments.Item(1)

Wscript.Echo "Adding " & MySource & " to " & MyTarget

'create a new clean zip archive
Set file = fso.CreateTextFile(MyTarget, True)
file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
file.close

winShell.NameSpace(MyTarget).CopyHere winShell.NameSpace(MySource).Items

do until winShell.namespace(MyTarget).items.count = winShell.namespace(MySource).items.count
    wscript.sleep 1000 
loop

Set winShell = Nothing
Set fso = Nothing

来源:Can Windows' built-in ZIP compression be scripted?