/build/static/layout/Breadcrumb_cap_w.png

How to Unzip a .zip file using VB Script to automatically skip any errors silently

Hi All,I am using the below VB Script to Unzip a .zip file of size 1.8GB having around 32,000+ files after Unzipping.

----------------------------------------------------------------------

Dim sCurPath

set filesys = Createobject("Scripting.FileSystemObject")

sCurpath = Replace(wscript.ScriptFullname, Wscript.ScriptName, "")
Set WshShell = CreateObject("Wscript.Shell")

ZipFile= sCurPath & "install-old.zip"
ExtractTo= "C:\InformaticaSource" 
 
If NOT filesys.FolderExists(ExtractTo) Then   
 filesys.CreateFolder(ExtractTo)
End If 

set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)

-------------------------------------------------------------------------------- 

While running the script on Windows 7 OS, I receive the DIALOG from "Interactive Services Detection" informing me that there is an error that I can retry,cancel or skip.

ERROR 0X80004005:Unspecified Error

This is the only error I receive and although I receive the error,I can see the file already present in the destination location with the same filesize(still I dont know why I receive the error) and I really want that the above script should automatically 'SKIP' errors when it is encountered.

Any Modifications to the above script to achieve this would be much appreciated..!! Thanks a lot for your assistance in advance..!!Kind Regards.


4 Comments   [ + ] Show comments
  • does the script have to be a vb script? - antmar9041 10 years ago
    • Hi, Well...I finally got a "workaround" the problem by using PKZIP software.and It works like a charm now.However, if there wasn't PKZIP or any other third party software,then how to I achieve it using VBScript. If this isn't possible through VB Script.I would definitely want to know WHY..? - satyapai 10 years ago
  • I did read a lot of posts on various tech forums and sites rehgarding this issue and the most common solution provided is to use another software for zipping and unzipping like 7-zip or PKZIP instead of VB Script.It looks like the OS Vista and Windows 7 which have the 'Interactive Services Dialog" coming up dont like zipping and Unzipping files using VB Script through Elevated User or System account and I wonder Y..? - satyapai 10 years ago
  • If you're going to just skip errors [ !!! ], why not add 'On Error Resume Next'?

    Alternatively, you could actually try to work out *why* you're seeing the error (which I suspect translates to 'Access denied', something which ProcMon - YAAAAAAWN! - would've told you on Day One!) and code accordingly. - anonymous_9363 10 years ago
  • Hey VBScab, 1. I had already already added 'On Error Resume Next' and it still gave the error on Windows Vista and Windows 7 OS(but not on Windows XP), please note that the problem was not with the VB Script, it was with the .zip file. Interestingly, when running on System context on Windows Vista and Windows 7 OS, it is the "Interactive Services Dialog Detection' window which comes up and gives the "Unspecified error". This error does not arise when manually running the VB Script on either of these OS.I did run PROCMON but it was 'stuck' on the 'interactive services detection' service. If I disable this service, the error gets suppressed but the installtion remains 'stuck' forever..so, there is something that prevents the VB file from unzipping it cleanly which SecureZip does like a charm, any thoughts on this will certainly help,..thank you :) - satyapai 10 years ago

Answers (2)

Posted by: mirzarafeeq20 10 years ago
White Belt
0

Unzipping a file is same as copying a file in vbscript. we can use xcopy instead of a normal copy which is handle through a dos in wondows OS.

Its difficult to have end users installed 7-zip or x zip without any licences. So just unzip the file at source and copy it to the destination folder .

Zipped File --> Unzippedfolder in source

unZippedFolder = sCurPath & "install-old"
Destinationfolder= "C:\InformaticaSource" 

wshShell.run ""xcopy " & sCurPath & "install-old\* " & " " & "C\InformaticaSource" & " /s /f /r /y /i /z""

\* --> Copy current folder all sub folders

/s --> To copy a folder including all subfolders.
/i --> defines the destination as folder.

/y -->Suppress prompt to confirm overwriting a file

/f-->Display full source and destination file names while copying.

/r-->Overwrite read-only files.

/z-->Copy files in restartable mode. If the copy is interrupted part way through, it will restart if possible. (use on slow networks)

hope it helps.

Posted by: Nico_K 10 years ago
Red Belt
0

got the same problem sometime ago and got around using 7-zip.

7za.exe x FILE.zip -y

this extracts all files with full folders and answers alls queries with "yes" (which also skips these errors)

Other packers may work too


Comments:
  • Thanks for your response..do you have any such option (answering all queries with "skip") in VB Script..? - satyapai 10 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ