# Uncompress the ZIP files using DOS script



## bharathi (Jul 7, 2010)

Hi, 

Below is the script, that I have tried to uncompress the zipped files.
But I am getting error as 

C:\sp\unz.vbs(8, 1) Microsoft VBScript runtime error: Object required: 'objShell
.NameSpace(...)'

unz.vbs
==========
Set WshShell = CreateObject("Wscript.Shell")
::user = WshShell.ExpandEnvironmentStrings("%UserName%")
strZipFile = "c:\sp\*.zip" 
outFolder = "c:\sp\win" 

Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions

unz.bat
========

cscript //nologo "C:\sp\unz.vbs"

Please help me out in this issue.

Thanks,
Bharathi


----------



## TheOutcaste (Aug 8, 2007)

bharathi said:


> strZipFile = "c:\sp\*.zip"


You can't use a wild card, you have to give the name of ONE Zipfile. Either use the batch file to pass the names one at a time, or make the unzip a subroutine and have the script get a collection of file names and call the subroutine.
http://www.robvanderwoude.com/vbstech_files_zip.php#CopyHereUNZIP

You'd want to use a different folder for each zip file too, unless you really want to unzip them all into the same folder


----------

