Solved

PowerShell Script

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now