使用 VBS 解压时出错

Error unzipping with VBS

我有 this 个用于解压缩文件的 VBS:

Set args = Wscript.Arguments

outputDirectory = WScript.Arguments.Item(0)
zipFile = WScript.Arguments.Item(1)

rem On Error Resume Next

Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(outputDirectory) Then
fso.CreateFolder(outputDirectory)
End If
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(zipFile).items
objShell.NameSpace(outputDirectory).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing

rem On Error Goto 0

问题是,当我从 .bat 中 运行 它时:

%zip_vbs_path% "%cd%\%zip_temp_dir%\" "%cd%\%OUTPUT_DIR%\!zip_plugin_name_!"

其中:

我收到这个错误:

提交答案时,请ELIF,因为我对VBS语言一点都不熟悉

对于这一行:

set FilesInZip=objShell.NameSpace(zipFile).items

您已将 zipFile 设置为:

Output\PluginName.jar

您使用的代码应该适用于 zip 个文件,但Shell.Application 无法从 jar 个文件中检索文件集合。