Solved

PowerShell Script

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

777 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