Solved

PowerShell Script

Posted on 2014-03-23
4
44 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 34

Accepted Solution

by:
Dan Craciun earned 500 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 34

Expert Comment

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

828 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