PowerShell Script

I am looking for power shell script to automate the unzipping of a .zip file.
Let me know what is the script which is required to do this.
LVL 1
SrikantRajeevAsked:
Who is Participating?
 
Dan CraciunConnect With a Mentor IT ConsultantCommented:
function Expand-ZIPFile($file, $destination) {
    $shell = new-object -com shell.application
    $zip = $shell.NameSpace($file)
    foreach($item in $zip.items()) {
        $shell.Namespace($destination).copyhere($item)
    }
}

Open in new window

Use as Expand-ZIPFile –File “C:\archive.zip” –Destination “C:\temp”

Code taken from here: http://www.howtogeek.com/tips/how-to-extract-zip-files-using-powershell/

If you need a more robust function, with error checking, see here: http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Function-to-727d6200

HTH,
Dan
0
 
SrikantRajeevAuthor Commented:
I will check this out.
0
 
SrikantRajeevAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for SrikantRajeev's comment #a39964497

for the following reason:

Thanks
0
 
Dan CraciunIT ConsultantCommented:
I think the OP meant to accept my comment.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.