Zip Files with Compress-Archive

Create or update a .zip from any files or folder contents straight from PowerShell.

WindowsZip & ArchivesarchivepowershellLow risk
Run `Compress-Archive -Path .\project\* -DestinationPath .\project-backup.zip` to zip the folder contents.

01Command

Command
$ Compress-Archive -Path .\project\* -DestinationPath .\project-backup.zip -Force

02What it does

Compress-Archive creates standard ZIP files that Explorer can open natively. `Path folder\*` archives the folder's contents, while `Path folder` archives the folder itself as a subfolder. If the destination exists, use -Update to add changed files or -Force to overwrite the whole archive. Its companion Expand-Archive extracts them back.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions