Use Tar to Create Zip Archive Files in Windows 11

Published by Nyau Wai Hoe - Updated on

The tar command is like a Swiss Army knife for dealing with files in both Unix and Linux, and guess what? It works in Windows 11 and Windows 10 too! This handy tool helps you bundle up a bunch of files and folders into one file, called a tarball. It’s great for when you need to move things around or keep them safe. Today, we’re going to talk about how you can use the tar command in Windows to zip things up. This is super useful if you’re dealing with lots of data and need a simple way to squeeze it all into one neat package. Let’s walk through how to do just that.

Also see: How to Open or Extract .Gz, Tar.gz or .Tar File in Windows 11/10

How to Use Tar to Create Zip Archive Files in Windows 11

Installation and setup of tar in Windows 11

Before we jump into zipping files, let’s make sure you’ve got tar ready to go on your Windows 11 or Windows 10. Since the Fall Creators Update in Windows 10, tar comes built-in, which is super handy. You can check if it’s there and get it set up with these steps:

  1. Checking for tar:
    • Open Command Prompt or PowerShell.
    • Type tar --version and hit Enter.
    • If you see a version number, you’re all set. If not, you’ll need to install it.Check if tar is installed CMD Windows 11
  2. Installing tar:
    • If tar’s missing, the easiest fix is to enable the Windows Subsystem for Linux (WSL).
    • Search for “Turn Windows features on or off” and click it.
    • In the window that pops up, check “Windows Subsystem for Linux” and click OK.
    • Restart your computer when asked.
    • After restarting, pick a Linux distribution from the Microsoft Store (like Ubuntu).WSL Ubuntu Windows 11
  3. Accessing tar:
    • With WSL and a Linux distribution installed, you can use tar either in the Linux shell or directly in Windows Command Prompt or PowerShell.

Now that tar is up and running on your computer, let’s get into how to use it for zipping files.

Suggested read: How to Zip Files and Folders in Windows 11/10 Without Any Software

Creating ZIP archives with tar command

Got tar ready? Awesome! Here’s how to start zipping your files into neat little packages using some simple commands:

  1. Opening command line interface:
    • Fire up Command Prompt or PowerShell, your choice.
    • Use the cd command to go to the folder with your files, like cd C:\Users\Username\Desktop\.Change directory to current folder CMD
  2. Basic tar command for ZIP archiving:
    • Here’s the simple formula for making a ZIP:
      tar -a -c -f file_or_directory_to_compress
    • This tells tar to pick ZIP format, create an archive, and name it.
  3. Example usage:
    • For zipping a folder called MyFolder, just type:
      tar -a -c -f MyFolder

      Use tar to create ZIP archive files in Windows 11

    • This creates a ZIP called with MyFolder inside.
  4. Archiving multiple files/directories:
    • To zip up several things at once:
      tar -a -c -f file1.txt file2.txt MyFolder

      Zip archiving multiple files and directories with tar command

    • This zips up file1.txt, file2.txt, and MyFolder all together.
  5. Checking the archive:
    • To double-check your zip:
      tar -tf

      Check tar zip archive files Windows

    • This lists everything in

By following these steps, zipping files with tar on Windows becomes a piece of cake, especially if you’re used to the Linux vibe or just like working with command lines.

Pro tip: How to Split a File Into Multiple Files in Windows 11

Next up, let’s check out some extra tips to get even more out of tar for zipping files.

Tips for efficient ZIP archiving with tar command

While the basics of tar are straightforward, a few extra tweaks can make your zipping process smoother and more customized to what you need. Here’s the lowdown:

  1. Creating archives in a specific directory:
    • If you want your ZIP to end up somewhere specific, just tell tar where to put it, like this:
      tar -a -c -f C:\Archives\ MyFolder

      Creating tar zip archives in a specific directory

  2. Excluding files or directories:
    • Don’t want everything in the ZIP? Exclude stuff like this:
      tar -a -c -f --exclude="file1.txt" MyFolder

      Excluding files and directories when using tar to create zip archives

  3. Creating archives with wildcards:
    • Wildcards (*) let you zip files that match a pattern. For all .txt files:
      tar -a -c -f *.txt

      Tar create zip archives with wildcards

  4. Verbosity in archiving:
    • Want to watch the action? Add -v to see files as they’re zipped:
      tar -a -cvf MyFolder

      Verbose in tar create zip archive Windows 11

  5. Checking archive integrity:
    • After zipping, check everything’s in order with:
      tar -tvf

      Checking tar zip archive integrity

  6. Using compression options:
    • While -a picks ZIP, you can also go for gzip or bzip2 with -z or -j:
      tar -czf myarchive.tar.gz MyFolder
      tar -cjf myarchive.tar.bz2 MyFolder

      Tar create tar.bz2 compression in Windows 11

  7. Batch archiving:
    • Need to zip lots of folders separately? In PowerShell:
      foreach ($folder in Get-ChildItem -Directory) {
      tar -a -c -f "$($folder.Name).zip" "$folder"

      How to batch archive zip files using tar in CMD Windows 11

With these tips, you’ll be a tar and zip wizard in no time, tweaking your archives to perfection.

Useful guide: Move All Files from Subfolders to Main Folder (Windows)

Creating tar.gz and tar archives with tar command in Windows 11

Apart from ZIP, tar can also make .tar.gz and .tar archives, which are like bread and butter in Unix and Linux. They’re super for backing up stuff or sharing software. Here’s how to whip these up:

Creating a tar.gz archive

  1. Basic tar.gz command:
    • For a .tar.gz archive, add the -z for gzip compression like this:
      tar -czf archive_name.tar.gz file_or_directory_to_compress
  2. Example usage:
    • To compress MyFolder into a .tar.gz:
      tar -czf myfolder.tar.gz MyFolder

      How to create tar.gz archive files in Windows 11 CMD

Creating a tar archive

  1. Basic tar command:
    • For a plain .tar (no compression), just skip the compression option:
      tar -cf archive_name.tar file_or_directory_to_compress
  2. Example usage:
    • To make a .tar of MyFolder:
      tar -cf myfolder.tar MyFolder

      Use tar command to create tar file in Windows 11

Additional options and tips

  • Verbosity: Like with ZIP, -v lets you watch the files being added.
  • Excluding files: Use --exclude to leave out stuff you don’t want in the archive.
  • Checking the archive: List the contents with tar -tf archive_name.tar.gz or tar -tf archive_name.tar to make sure everything’s there.Check the content of a tar archive file in CMD

Making .tar.gz and .tar archives with tar in Windows bridges the gap between Windows and Unix/Linux, offering more ways to handle your files.

Concluding thoughts

We’ve covered a lot about the tar command in Windows, from zipping files to making .tar.gz and .tar archives. Starting with getting tar set up to looking into all the cool things you can do with it, this guide should help you handle your files like a pro, whether for personal use, work, or managing systems. Knowing how to use tar in Windows can really streamline your work and keep your files organized across different platforms.

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link