Created
January 20, 2016 04:39
-
-
Save alex-berezan/82af20ca247edb514763 to your computer and use it in GitHub Desktop.
quick sample for unzipping archive via powershell 2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Unzip-Archive([string] $ZipFileName, [string] $DestinationDirectory) | |
{ | |
if(-not [System.IO.Directory]::Exists($DestinationDirectory)) | |
{ | |
[System.IO.Directory]::CreateDirectory($DestinationDirectory) | Out-Null | |
} | |
$shell_app = New-Object -com shell.application | |
$zip_file = $shell_app.namespace($ZipFileName) | |
$destination = $shell_app.namespace($DestinationDirectory) | |
$Flag_OverrideExisting_HideDialog = 0x14 | |
$destination.Copyhere($zip_file.items(), $Flag_OverrideExisting_HideDialog) | |
} | |
Unzip-Archive -ZipFileName "C:\Users\Aleksey\Downloads\ziptest\zipped.zip" ` | |
-DestinationDirectory "C:\Users\Aleksey\Downloads\ziptest\unzipped" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment