unzip.vbs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ' j_unzip.vbs
  2. '
  3. ' UnZip a file script
  4. '
  5. ' By Justin Godden 2010
  6. '
  7. ' It's a mess, I know!!!
  8. '
  9. ' Dim ArgObj, var1, var2
  10. Set ArgObj = WScript.Arguments
  11. If (Wscript.Arguments.Count > 0) Then
  12. var1 = ArgObj(0)
  13. Else
  14. var1 = ""
  15. End if
  16. If var1 = "" then
  17. strFileZIP = "example.zip"
  18. Else
  19. strFileZIP = var1
  20. End if
  21. 'The location of the zip file.
  22. REM Set WshShell = CreateObject("Wscript.Shell")
  23. REM CurDir = WshShell.ExpandEnvironmentStrings("%%cd%%")
  24. Dim sCurPath
  25. sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
  26. strZipFile = sCurPath & "\" & strFileZIP
  27. 'The folder the contents should be extracted to.
  28. outFolder = sCurPath & "\"
  29. WScript.Echo ( "Extracting file " & strFileZIP)
  30. Set objShell = CreateObject( "Shell.Application" )
  31. Set objSource = objShell.NameSpace(strZipFile).Items()
  32. Set objTarget = objShell.NameSpace(outFolder)
  33. intOptions = 256
  34. objTarget.CopyHere objSource, intOptions
  35. WScript.Echo ( "Extracted." )
  36. ' This bit is for testing purposes
  37. REM Dim MyVar
  38. REM MyVar = MsgBox ( strZipFile, 65, "MsgBox Example"