$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