Have some files and need to create a zip archive using Powershell? No problem, it’s built in!
Since PowerShell version 5+, there is an Compress-Archive command built in:
Compress-Archive running in PowerShell Compress-Archive -Path file.txt, file2.txt -CompressionLevel Fastest -DestinationPath C:\compress\to\here\myzipfile.zip Note: There’s a 2 GB max file size limit due to a limitation of the underlying API.
Not sure which version of PowerShell you have?
$PSVersionTable.PSVersion Use Splatting As seen in the example these lines can get long!