1

I have this VBS for unzipping files:

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

The issue is, when I run it from a .bat with:

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

where:

  • %zip_vbs_path is the path to said VBS
  • %zip_temp_dir%=zip_temp
  • %OUTPUT_DIR%\!zip_plugin_name_!=Output\PluginName.jar

I get this error:

Error MSG

When submitting an answer, please ELIF, because I'm not familiar with the VBS lanugage at all.

Quelklef
  • 1,999
  • 2
  • 22
  • 37

1 Answers1

3

For this line:

set FilesInZip=objShell.NameSpace(zipFile).items

You have zipFile set to:

Output\PluginName.jar

The code you're using should work for zip files butShell.Application cannot retrieve the file collection from a jar file.

Bond
  • 16,071
  • 6
  • 30
  • 53