Create 7z and tar Archives on Windows 11 Natively
In this article
Yes, Windows 11 can create both 7z and tar archive files without any third-party software. The built-in Tar command handles .tar, and the 7-Zip command-line tool is included as part of the operating system's optional features (though it's actually the open-source 7-Zip that Microsoft ships). You'll use Command Prompt or PowerShell to run these commands. This guide shows you the exact steps, plus how to handle common issues.
What You'll Need
- Windows 11 (any recent version, 22H2 or later recommended)
- Command Prompt or PowerShell (both are preinstalled)
- Files or folders you want to archive
- Administrator rights are not required for basic archiving, but might be needed if you archive system-protected folders.
Step-by-Step
Creating a .tar Archive
- Open Command Prompt or PowerShell. Press Win + R, type
cmdorpowershell, and press Enter. (You can also search for it in the Start menu.) - Navigate to the folder containing the files you want to archive. Use the
cdcommand, for example:cd C:\Users\YourName\Documents\MyFiles. (Replace the path with your actual folder.) - Run the tar command with the
cfoption (create file). The basic syntax is:
tar -cf archive.tar file1.txt file2.jpg folder1
This createsarchive.tarin the current folder, containing those files and the folder (and everything inside it). - To archive an entire folder, you can just specify the folder name:
tar -cf archive.tar MyFolder - To add compression (making a .tar.gz or .tgz), add the
zoption:
tar -czf archive.tar.gz MyFolder - Press Enter. The archive is created instantly. You'll see no output if successful (unless you add the
voption for verbose listing).
Creating a .7z Archive
- Open Command Prompt or PowerShell as above.
- Navigate to the folder containing the files you want to archive, using
cd. - Run the 7z command. The basic syntax is:
7z a archive.7z file1.txt file2.jpg folder1
Theastands for "add" (create archive). This createsarchive.7zin the current folder. - To archive an entire folder, just specify the folder name:
7z a archive.7z MyFolder - To set a password, add the
-pswitch:
7z a archive.7z MyFolder -pYourPassword
(ReplaceYourPasswordwith your actual password. You'll be prompted to confirm it.) - Press Enter. The archive is created. You'll see a summary of the operation.
Note: Menu and command options might differ slightly depending on your Windows 11 version and regional settings, but the core commands above are standard.
Common Mistakes
- Using the wrong syntax: Forgetting the
ain 7z or the-cfin tar will cause errors. - Not navigating to the correct folder: If you don't
cdto the folder, the archive will be created in the current directory (often the user profile) and may not contain the files you expect. - Spaces in file names: If a file or folder name has spaces, you must enclose it in quotes, e.g.,
tar -cf archive.tar "My Folder". - Using backslashes incorrectly: Windows uses backslashes in paths, but in some contexts you might need forward slashes. Usually, backslashes work fine in Command Prompt.
- Overwriting existing archives: If an archive with the same name exists, the command will overwrite it without asking. Double-check before running.
Tips
- Use absolute paths: You can specify full paths without changing directories, e.g.,
tar -cf C:\Backups\archive.tar C:\Users\Name\Documents. This is handy for scripting. - Compress with tar and gzip: The
-zoption gives you better compression than plain tar. For maximum compression, use-Jfor xz:tar -cJf archive.tar.xz MyFolder. - List archive contents: To see what's inside an archive without extracting, use
tar -tf archive.taror7z l archive.7z. - Extract archives: To extract, use
tar -xf archive.taror7z x archive.7z. The latter preserves folder structure. - Create a script: If you archive regularly, save the command in a .bat or .ps1 file and run it when needed.
- Check file sizes: After creating an archive, use
dirorlsto confirm the file exists and check its size.
Troubleshooting
"'tar' is not recognized as an internal or external command"
This means the tar command is not available. On Windows 11, it should be present, but if not, you can enable it via Settings > Apps > Optional Features > Add an optional feature. Look for Tar and 7-Zip (both are listed as optional features). Install them and restart your terminal.
"'7z' is not recognized..."
Same as above—install the 7-Zip optional feature from Settings. If it's already installed but not recognized, try using 7zr or 7za (some versions use different executable names). You can also check if it's in C:\Windows\System32—if not, the feature isn't installed.
Access denied when archiving system folders
If you try to archive folders like C:\Windows, you'll get permission errors. Run Command Prompt as Administrator (right-click > Run as administrator) to get around this. Be careful—archiving system files can take a long time and produce huge archives.
The archive is created but seems incomplete
Check if you used the correct syntax. For tar, if you forget the -f option, tar might write to a device instead of a file. For 7z, make sure you didn't accidentally add a wildcard that excluded files. Also, verify that the source files aren't locked by other programs.
The command hangs or takes forever
This usually happens when archiving a very large folder or a folder with many small files. Wait a bit longer. If it's stuck, press Ctrl + C to cancel, then try archiving a subfolder first to test.
Password-protected 7z won't open on another PC
Make sure you remember the password. If you forget it, there's no way to recover the data. Always store passwords in a secure password manager.
Frequently Asked Questions
Can I create a .7z file using the right-click context menu?
No, Windows 11 does not add a context menu option for 7z by default. You must use the command line. (Third-party tools like 7-Zip add that, but you asked for native.)
Is tar available in PowerShell as well?
Yes, both tar and 7z work in PowerShell exactly the same as in Command Prompt. You can use either terminal.
Can I create a multi-volume 7z archive (split into parts)?
Yes, the native 7z command supports the -v switch, e.g., 7z a archive.7z MyFolder -v100m to split into 100 MB parts. Tar does not support splitting natively.
Does the native 7z support all compression levels?
Yes, you can specify levels from 0 (store) to 9 (ultra) using the -mx switch, e.g., 7z a archive.7z MyFolder -mx=9. The default is 5.
Can I update an existing archive without recreating it?
Yes, for 7z use 7z a archive.7z newfile.txt to add a file, or 7z u archive.7z to update with changes. For tar, you cannot update in place—you'd need to extract, modify, and re-archive.
Are these commands safe for backup purposes?
Yes, but keep in mind that tar does not compress by default, so it's not space-efficient. For backups, consider using tar -czf or 7z with compression. Also, always verify your archives by listing or extracting them after creation.