Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PowerShell Script

Posted on 2014-03-23
4
Medium Priority
?
61 Views
Last Modified: 2015-09-20
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.
0
Comment
Question by:SrikantRajeev
  • 2
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 2000 total points
ID: 39949663
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
 
LVL 1

Author Comment

by:SrikantRajeev
ID: 39964497
I will check this out.
0
 
LVL 1

Author Comment

by:SrikantRajeev
ID: 40985926
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
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 40985927
I think the OP meant to accept my comment.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question