PowerShell: Create Archive zip, tar, 7z

By Xah Lee. Date: . Last updated: .

Create Zip Archive

Compress-Archive x_source_dir target.zip

Note: As of 2026-10-03, the max zip file Compress-Archive can create is 2 GB. See help Compress-Archive

note: if the file name contains chinese or other non-ascii characters, Compress-Archive works correctly. see Create zip archive with utf-8 encoding for filenames

Create Tar Archive

Windows 10, Windows 11, have BSD tar builtin, at

C:/Windows/system32/tar.exe

# create tar file
tar cvf dirname.tar dirname

tar -h for help.

Create 7z archive

# create a 7z archive
7z a Pictures.7z Pictures
# create a zip archive
7z a Pictures.zip Pictures