unpack-zip.vbs 823 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. On Error Resume Next
  2. Set fso = CreateObject("Scripting.FileSystemObject")
  3. Set shell = CreateObject("Wscript.Shell")
  4. Sub UnZIP(zipfilename, destinationfolder)
  5. With CreateObject("Shell.Application")
  6. .NameSpace(destinationfolder).Copyhere .NameSpace(zipfilename).Items
  7. End With
  8. End Sub
  9. zipfile = WScript.Arguments(0)
  10. If Err.Number <> 0 Then
  11. WSCript.Quit 1
  12. End If
  13. outdir = WScript.Arguments(1)
  14. If Err.Number <> 0 Then
  15. WSCript.Quit 1
  16. End If
  17. WScript.Echo zipfile
  18. WScript.Echo outdir
  19. If fso.FolderExists(fso.GetAbsolutePathName(outdir)) Then
  20. fso.DeleteFolder fso.GetAbsolutePathName(outdir)
  21. End If
  22. fso.CreateFolder fso.GetAbsolutePathName(outdir)
  23. If Err.Number <> 0 Then
  24. WSCript.Quit 1
  25. End If
  26. UnZIP fso.GetAbsolutePathName(zipfile), fso.GetAbsolutePathName(outdir)
  27. If Err.Number <> 0 Then
  28. WSCript.Quit 1
  29. End If