Advertisement
Guest User

Untitled

a guest
Jul 4th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. strZipFile = "dungeon.zip"
  2. strUnzipped = "dungeon"
  3.  
  4. Sub UnZip(ExtractTo,ZipFile)
  5.  
  6. Set fso = CreateObject("Scripting.FileSystemObject")
  7. If NOT fso.FolderExists(ExtractTo) Then
  8. fso.CreateFolder(ExtractTo)
  9. End If
  10.  
  11. Set objShell = CreateObject("Shell.Application")
  12. Set FilesInZip=objShell.NameSpace(ZipFile).items
  13.  
  14. ObjShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
  15. Set fso = Nothing
  16. Set objShell = Nothing
  17. End Sub
  18.  
  19. set WshShell = WScript.CreateObject("WScript.Shell")
  20. strDesktop = WshShell.SpecialFolders("MyDocuments")
  21.  
  22. strZipPath = strDesktop & strZipFile
  23. strUnzipPath = strDesktop & strUnzipped
  24.  
  25. UnZip strUnzipPath , strZipPath
  26.  
  27. cscript UnzipZip.vbs
  28.  
  29. C:UsersBrettDownloadsUnzipZip.vbs(12, 1) Microsoft VBScript runtime error: Object required: 'objShell.NameSpace(...)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement