I have a .zip file and need to unpack its entire content using Powershell. I\'m doing this but it doesn\'t seem to work:
$shell = New-Object -Co
Here is a simple way using ExtractToDirectory from System.IO.Compression.ZipFile:
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
Unzip "C:\a.zip" "C:\a"
Note that if the target folder doesn't exist, ExtractToDirectory will create it. Other caveats:
See also: