Unzipping Files

by Oct 12, 2012

Unfortunately, there is no built-in cmdlet to unzip files. There are plenty of 3rd party tools, many of which are free. If you cannot use these tools, here's how native Windows components can unzip files, too.

Note that this requires the built-in Windows ZIP support to be present and not replaced with other ZIP tools.

$Source = 'c:\some\zipfile.zip'
$Destination = 'c:\unpackfolder'  # this folder MUST exist

Unblock-File $Destination    # use this in PowerShell v3 to unblock downloaded data
                # remove this in PowerShell v2 and unblock manually if needed

$helper = New-Object -ComObject Shell.Application
$files = $helper.NameSpace($Source).Items()
$helper.NameSpace($Destination).CopyHere($files)

Twitter This Tip! ReTweet this Tip!