在 VBScript 中使用 CopyHere 的 .zip 文件是否有大小限制? [英] Is there a size limit for a .zip file using CopyHere in VBScript?

查看:44
本文介绍了在 VBScript 中使用 CopyHere 的 .zip 文件是否有大小限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将多个 zip 文件解压缩到不同位置的 vbscript.该代码适用于除一个文件之外的所有文件.这个不起作用的文件恰好大于 6GB.我正在处理的下一个最大的文件大约是 3.5GB.

I have a vbscript that extracts multiple zip files to different locations. The code works for all but one file. This one file, that doesn't work, happens to be bigger than 6GB. The next, biggest, file that I am processing is around 3.5GB.

这是代码片段;

strFileDest = "path\to\some\dir1"
strZIPname = "file1.zip" 
Call UnPack(strFileDest, strZIPname)

strFileDest = "path\to\some\dir2"
strZIPname = "file2.zip" 
Call UnPack(strFileDest, strZIPname)

Function UnPack(strZIPdest, strZIPname)
  Dim intOptions, objShell, objSource, objTarget

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objShell = CreateObject("Shell.Application")
  sSourceFile = objFSO.GetAbsolutePathName(strZIPname)
  Set objSource = objShell.NameSpace(sSourceFile).Items()
  Set objTarget = objShell.NameSpace(strZIPdest)

 intOptions = 256
 If objFSO.FolderExists(strZIPdest) Then
   objTarget.CopyHere objSource, intOptions
 Else
   MsgBox "Cannot complete unzip for " & strZIPname & ". The destination _
   directory (" & strZIPdest & ") could not be located.", 0, "Invalid"
 End If
End Function


我取了一个较小的 zip 并将其重命名为不会复制的 zip.使用新的大小,脚本将解压缩该文件,证明该文件的其余脚本有效.我还通过手动提取验证了 zip 是否有效.当我运行脚本并将其指向大 zip 时,我也没有收到任何错误(我没有使用 On Error resume next).

推荐答案

是的.据我所知,它大约为 2GB,尽管我之前遇到过它并没有记录.如果您需要压缩比这更大的内容,请使用 7zip 的命令行版本.

Yes there is. As far as I know it's around 2GB, though it's undocumented I've encountered it before. If you need to compress something larger than that, use the command line version of 7zip.

这是我为 7zip 编写的 VBScript 包装器.

这篇关于在 VBScript 中使用 CopyHere 的 .zip 文件是否有大小限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆