Cyber Security

Use PowerShell to create compressed ZIP files

With PowerShell 5.0 two new commands are introduced: Compress-Archive and Expand- Archive. The commands compress and decompress data.

Get-Command -Noun Archive

unbenannt

Compress-Archive compresses data.

Compress-Archive -Path C:\Temp\* -DestinationPath C:\Temp\Compressed.zip

Unbenannt.PNG

The ZIP File was generated.

Unbenannt.PNG

Expand-Archive decompresses the files.

Expand-Archive -Path C:\Temp\Compressed.zip -DestinationPath C:\Temp\

Unbenannt.PNG

Further thoughts

If you can´t do without WinZip, I recommend my article Package Management in PowerShell (Chocolatey)

2 replies »

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.