Commands / Files

Compress-Archive

Zip a folder or files

beginner Files

Compress-Archive
 Compress-Archive -Path .\docs -DestinationPath .\docs.zip
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Compress-Archive

Zips files or a whole folder. Passing a folder puts the folder itself inside the zip. Passing .\docs\* puts only its contents in.

Common parameters

Try this

Compress-Archive -Path .\docs\*.md -DestinationPath .\markdown.zip -Force

For big files, use tar.exe, which is built into Windows 10 and 11:

tar.exe -a -c -f .\docs.zip .\docs

Want a dated name like docs-20260107-0930.zip? Use the zip builder.

Coming from another shell

ShellWhat you might type
bash / zshzip -r docs.zip docs
cmd.exetar -a -c -f docs.zip docs

More in From bash and From cmd.

Related commands