Muokkaa

tar on Windows

tar is a command-line archiving tool that's included with Windows. It lets you create, list, and extract archive files — including .tar, .tar.gz, .zip, and .7z — directly from the command line, without installing additional software.

The Windows build of tar is based on libarchive's bsdtar and supports the same flags developers already use on Linux and macOS, so existing scripts and habits carry over.

Common commands

Extract an archive:

tar -xf archive.tar.gz

Create a .tar.gz from a folder:

tar -czf archive.tar.gz .\my-folder

Create a .zip from a folder (the -a flag auto-selects the archive format from the file extension, replacing format-specific flags like -z, -j, -J, and -Z):

tar -caf archive.zip .\my-folder

List the contents of an archive without extracting:

tar -tf archive.tar.gz

For the full list of options, run tar --help or the FreeBSD Tar manual.