Skip to content

Instantly share code, notes, and snippets.

@sweeneyrobb
Last active August 29, 2015 14:08
Show Gist options
  • Save sweeneyrobb/73dc26f3aea1bc722b6e to your computer and use it in GitHub Desktop.
Save sweeneyrobb/73dc26f3aea1bc722b6e to your computer and use it in GitHub Desktop.
function Extract-Zip ($zipFile, $directory = ".\") {
if ($directory -is [string]) {
$directory = Get-Item $directory }
if ($zipFile -is [string]) {
$zipFile = Get-Item $zipFile }
$zip = (New-Object -ComObject shell.application).NameSpace($zipFile.FullName)
$destination = (New-Object -ComObject shell.application).namespace($directory.FullName)
if ($directory.PSIsContainer) {
$destination.CopyHere($zip.Items()) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment