Use tar on Windows to Create and Extract Archives

Windows 10/11 bundle bsdtar, so tar -czf and tar -xzf work natively in cmd and PowerShell — including .zip files.

WindowscmdarchivedevelopertarLow risk
Create with tar -czf backup.tar.gz -C C:\Proj . and extract with tar -xzf backup.tar.gz -C D:\Restore.

01Command

Command
$ tar -czf backup.tar.gz -C C:\Proj .
tar -xzf backup.tar.gz -C D:\Restore

02What it does

Since Windows 10 1803, bsdtar (the libarchive implementation) ships in System32, closing the gap with Linux/macOS workflows — handy for source trees, Docker context files and anything that expects a tarball. -C changes the source directory so the archive stores relative paths instead of full ones like C:\. The same binary also extracts .zip files (tar -xf file.zip) and auto-detects compression, so plain tar -xf works for both .tar.gz and .tar.bz2.

03Risk

RiskLow risk
RequirementsWindows 10 1803+ / Windows 11 (bsdtar bundled); works in cmd and PowerShell.
!Warning: tar does not encrypt or password-protect archives, and Windows' case-insensitive filesystem can surprise you with duplicate entries from Linux tarballs.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • TAR - SS64
    SS64 · technical · 2026-09-17
    Evidence: Shows tar create/extract examples on Windows and notes it also reads .zip archives.

Last verified: 2026-09-18 · Category: Developer

06Related solutions