Expand-Archive c:\apps.zip -DestinationPath c:\temp
The above simple one like code extracts the apps.zip file in destination location C:\temp Example 2Expand-Archive -LiteralPath C:\source\file.Zip -DestinationPath C:\destination
Example 3Expand-Archive -Path file.Zip -DestinationPath C:\destination -Force
Add-Type -AssemblyName System.IO.Compression.FileSystem function UnzipFiles { param([string]$zippedfile, [string]$outpath) [System.IO.Compression.ZipFile]::ExtractToDirectory($zippedfile, $outpath) } Unzipfiles "C:\a.zip" "C:\a"The variable used in this script are. $zippedfile= You need to specify the path where the zipped file exists $outpath= You need to specify the path where you want to unzip or extract the files.
Unzipfiles “C:\a.zip” “C:\a”
Thank you for reading this article, if you have any questions please let us know. Thank you for visiting my site, for any scripts in these articles you are testing please make sure you have tested this script in our lower environment before you run in production.
Leave a Reply Cancel reply