Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

unzip files using power shell throwing error

$
0
0
$shell=new-object -com shell.application 
$CurrentLocation="c:\temp"
$CurrentPath=$CurrentLocation.path 
$Location=$shell.namespace($CurrentPath) 
$ZipFiles = get-childitem *.zip 
$ZipFiles.count | out-default 
foreach($ZipFile in $ZipFiles){ 
$ZipFile.fullname | out-default 
$ZipFolder = $shell.namespace($ZipFile.fullname) 
$Location.Copyhere($ZipFolder.items()) 
}


I am trying to unzip files on same location getting error:

You cannot call a method on a null-valued expression.
At line:10 char:36
+ $Location.Copyhere($ZipFolder.items <<<< ()) 
    + CategoryInfo          : InvalidOperation: (items:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull



--Himanshu Kulkarni




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>