我有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_!"
哪里:
%zip_vbs_path
是上述 VBS 的路径%zip_temp_dir%
=zip_temp
%OUTPUT_DIR%\!zip_plugin_name_!
=Output\PluginName.jar
我收到这个错误:
提交答案时请ELIF ,因为我根本不熟悉 VBS 语言。
最佳答案
对于这一行:
set FilesInZip=objShell.NameSpace(zipFile).items
您将 zipFile
设置为:
Output\PluginName.jar
您使用的代码应该适用于 zip
文件,但是 Shell.Application
无法从 jar
文件中检索文件集合。
关于windows - 使用 VBS 解压时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31084442/