Posts

Showing posts from February, 2019

PowerShell Unzip File

PowerShell Unzip File OK, I seem to run into this every now and then, so I decided to write it down so I don't forget it. If you need to extract a zip file in PowerShell use the following: Expand-Archive -Path "nugetPackage.zip" "z:\Temp\nugetPackage" You can make this a function, but that seems a little redundant, since it's already a function: function UnzipFile {     param([string] $source, [string] $destination)     Expand-Archive -Path "$source" "$destination" } And you can call the new function like this: UnzipFile "nugetPackage.zip" "z:\Temp\nugetPackage" You might get unsupported archive file type, so you can always rename the file to .zip to get around this; assuming the file is in zip format, but has a different file extension. This happens with .xap, .jar, .nupkg, etc... mv nugetPackage.nupkg nugetPackage.zip Expand-Archive -Path "nugetPackage.zip" "z:\Temp\nugetPackage&