How to Unzip Files in CMD (Windows 10 & 11) – 4 Methods

June 11, 2024 / General Discussion

Need to extract a ZIP file without touching your mouse? Windows gives you four solid ways to unzip from the command line no third-party tools required for most cases. This guide covers all of them, from the simplest one-liner to batch extraction and password-protected archives.

Method 1: Using tar in Command Prompt (built-in)

Windows includes a built-in tar command, so you can extract standard ZIP archives without installing additional software.

Basic extraction (same folder)

Open Command Prompt, navigate to the folder containing your ZIP file, and run:

tar

The files will be extracted into the current directory.

Extract to a specific destination folder

Use the -C flag followed by the destination path:

flag

i: The destination folder must already exist. If it doesn’t, create it first with mkdir “C:\path\to\folder,” then run the tar command.

Step-by-step walkthrough

1. Open Command Prompt. Right-click the Start menu and select Terminal (Admin) or Command Prompt (Admin).

2. Navigate to the ZIP file location using the cd command:

cd C:\Users\YourName\Downloads

3. Run the extraction command. Replace filename.zip with your actual file name:

tar -xf filename.zip

4. Done. The contents appear in the same folder. No confirmation message is shown on success; that’s normal.

Useful tar flags:

Use for Flags

Method 2: Using PowerShell’s Expand-Archive

PowerShell’s Expand-Archive cmdlet is the most flexible native option, with better path handling and the ability to overwrite existing files.

Basic syntax

Syntax

Common usage examples

Common Usage

PowerShell creates the destination folder automatically if it doesn’t exist — unlike tar, which requires the folder to exist first.

How to open PowerShell

Press Win + X and choose Terminal or Windows PowerShell. On Windows 11, PowerShell is the default terminal. You can also type PowerShell directly into the CMD window.

Check PowerShell version (required: 5.0+)

Expand-Archive requires PowerShell 5.0 or later. To check:

$PSVersionTable.PSVersion

All modern Windows 10 and Windows 11 systems have PowerShell 5.1 or later installed by default.

Method 3: Unzipping .7z files with 7-Zip via CMD

Windows has no built-in support for .7z archives. To handle them from the command line, install 7-Zip (free and open-source), which also installs a command-line executable.

Step 1 — Install 7-Zip: Download the installer from 7-zip.org and install it. The default installation path is C:\Program Files\7-Zip\.

Step 2 — Add 7-Zip to your PATH: This lets you call 7z from any folder in CMD. If you skip this, prefix every command with the full path “C:\Program Files\7-Zip\7z.exe”.

Step 3 — Extract the archive

Extract

i Note: there is no space between -o and the path. Writing -o “C:\Output” with a space will cause an error.

7-Zip command reference

Zip command reference

7-Zip works with ZIP, 7z, TAR, GZ, RAR, ISO, and many other formats, making it the most versatile command-line extraction tool on Windows.

Method 4: Unzipping password-protected ZIP files

Windows’ built-in tar command does not support password-protected archives. For this, you need either 7-Zip or PowerShell with the right module.

Using 7-Zip (recommended)

Using 7-Zip

Method comparison

Not sure which method to use? Here’s a quick reference:

Method Needs installation? ZIP .7z / RAR Password Best for
tar (CMD) No Quick ZIP extraction, no setup
Expand-Archive No Scripting, batch jobs, and auto-create folders
7-Zip (7z) Yes (free) All archive types, passwords, and advanced use

Common errors and how to fix them

Error: tar: Error opening archive: Failed to open
Cause: The file path is wrong, or the file doesn't exist in the current directory.
Fix: Run dir to list files in the current folder and confirm the exact filename and extension. Use cd to navigate to the correct folder first.
Error: Access is denied
Cause: CMD or PowerShell is not running with Administrator privileges.
Fix: Close the terminal and reopen it by right-clicking and selecting Run as administrator.
Error: Expand-Archive: The path already exists
Cause: Files from a previous extraction already exist in the destination folder.
Fix: Add -Force to the command to overwrite existing files: Expand-Archive -Path file.zip -DestinationPath .\output -Force
Error: tar is not recognized as an internal or external command
Cause: Your Windows version predates the tar integration (pre-Windows 10 build 17063).
Fix: Update Windows 10 to a recent version, use PowerShell's Expand-Archive instead, or install 7-Zip.
Archive extracts, but files appear corrupt or incomplete
Cause: The ZIP file itself may be corrupt, or the download was interrupted.
Fix: Re-download the file. To verify archive integrity with 7-Zip before extracting: 7z t filename.zip
FAQs
  1. How do I unzip a file in CMD on Windows 11?
    Use the built-in tar command: navigate to the folder with cd, then run tar -xf filename.zip. For a specific destination, add -C “C:\path\to\folder”. Windows 11 also supports PowerShell’s Expand-Archive, which is often easier for scripting.
  2. Can I unzip files without installing any software?
    Yes. Both tar (in CMD) and Expand-Archive (in PowerShell) are built into Windows 10 and 11. No third-party software is needed for standard ZIP files. For .7z, RAR, or password-protected archives, you will need 7-Zip.
  3. What’s the difference between tar -xf and Expand-Archive?
    Both extract ZIP files natively. The main practical differences: Expand-Archive automatically creates the destination folder if it doesn’t exist, while tar requires the folder to exist first. PowerShell’s Expand-Archive is also better for scripting and batch operations. For quick one-off extractions, either works.
  4. How do I unzip a .7z file using CMD?
    Install 7-Zip from 7-zip.org, then run 7z x filename.7z in CMD. To extract to a specific folder, use 7z x filename.7z -o”C:\Output” (no space between -o and the path).
  5. How do I zip files using Command Prompt?
    Use the tar command with the -cf flag: tar -cf archive.zip file1.txt file2.txt. In PowerShell, use Compress-Archive -Path “C:\folder” -DestinationPath “C:\archive.zip”. See our full guide on zipping files via the command prompt.
  6. How do I unzip multiple files at once in CMD?
    In PowerShell, run: Get-ChildItem -Filter *.zip | ForEach-Object { Expand-Archive -Path $_.FullName -DestinationPath ($_.BaseName) -Force } this extracts each ZIP into its own subfolder named after the archive.
  7. How do I unzip files in Windows 10 without WinZip?
    Windows 10 has built-in extraction tools. In File Explorer, right-click the ZIP and choose Extract All. From CMD, use tar -xf filename.zip. From PowerShell, use Expand-Archive -Path filename.zip -DestinationPath .\output. No paid tools like WinZip are needed.

 

Once you’ve extracted your files, you can compress them again using the same tar command. Here’s how: [How to Zip Files via Command Prompt ]