Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Performance test for expand ZIP archive
$archivePath = "C:\"
$destinationFolder = "D:\Test"
mkdir $destinationFolder -Force
for( $i = 0; $i -lt 10; $i++ )
$measureExpand = Measure-Command {
Expand-Archive $archivePath "$destinationFolder\TestExpand$i" -Force
$measureExtract = Measure-Command {
Add-Type -assembly System.IO.Compression.Filesystem
[io.compression.zipfile]::ExtractToDirectory($archivePath, "$destinationFolder\TestExtract$i")
Write-Host "Measure archive extraction $((Get-Item $archivePath).length/1MB) MB" -ForegroundColor Green
Write-Host "ExtractToDirectory $($measureExtract.Minutes):$($measureExtract.Seconds)"
Write-Host "Expand-Archive $($measureExpand.Minutes):$($measureExpand.Seconds)"
rmdir $destinationFolder -Force -Recurse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment