PowerShell: Create Archive zip, tar, 7z

By Xah Lee. Date: . Last updated: .

Create Zip Archive

Compress-Archive Pictures/ pic.zip

Note: the max zip file Compress-Archive can create is 2 GB. As of 2021-11-07. See help Compress-Archive

Use 7z instead.

Create Tar Archive

Windows 10 has BSD tar builtin, at C:/Windows/system32/tar.exe

# create tar file
tar cvf dirname.tar dirname

tar -h for help. For more detail see Linux: Extract tar zip gzip lzip bzip2 xz rar

Create 7z archive

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

PowerShell: archive file, compression