Repair Broken Archives with 7-Zip Command Line
This guide covers how to diagnose, salvage, and recover data from
damaged or corrupted archives using the 7-Zip command-line interface
(7z). While 7-Zip does not feature a dedicated one-click
repair command like some proprietary archivers, its command-line tool
provides powerful testing, type-forcing, and error-bypassing parameters
to extract uncorrupted files and rebuild broken multi-part volumes.
Step 1: Diagnose the Damage with the Test Command
Before attempting recovery, run a diagnostic test to identify whether the corruption affects the file headers, compressed data blocks, or specific subfiles.
Open your terminal or Command Prompt and run:
7z t damaged_archive.7zt: Tests archive integrity by verifying CRC checksums without writing files to the disk.
If the output displays specific subfiles with errors, note their paths. Files not flagged with CRC or data errors can usually be extracted intact.
Step 2: Force Extract Recoverable Files
When an archive has partial corruption, a standard GUI extraction may abort completely. The command line allows you to bypass prompts and pull out any uncorrupted files:
7z x damaged_archive.7z -y -aosx: Extracts files with full paths preserved.-y: Automatically answers "yes" to all prompts, preventing the process from hanging on corrupt blocks.-aos: Skips extracting existing files if you are running multiple recovery attempts.
If the archive format is standard .zip, you can also
attempt:
7z e damaged_archive.zip -ye: Extracts files directly into the current directory, ignoring broken directory trees that may reside in corrupt header blocks.
Step 3: Explicitly Force Archive Parser Type
If an archive's header is partially overwritten, 7-Zip might fail to
detect the container type automatically. You can force the parser using
the -t switch:
7z x damaged_archive.bin -t7zOr for a damaged ZIP container:
7z x damaged_archive.bin -tzipForcing the parser instructs 7-Zip to search the entire binary stream for signature headers rather than relying on standard offsets.
Step 4: Fix Damaged Multi-Volume (Split) Archives
If you are dealing with split archives (e.g., .7z.001,
.7z.002) and one segment is missing or corrupt, you can
rebuild a contiguous file before extracting.
On Windows Command Prompt:
copy /b damaged_archive.7z.001 + damaged_archive.7z.002 + damaged_archive.7z.003 combined.7zOn Linux or macOS:
cat damaged_archive.7z.* > combined.7zOnce merged, attempt extraction with forced detection:
7z x combined.7z -t7zStep 5: Handling Corrupt Start Headers
If 7-Zip reports a Headers Error or
Can not open the file as archive, the beginning of the file
is damaged. You can scan for the embedded archive payload and attempt
extraction from a shifted offset:
- Check if an end header exists:
7z l -t7z.split damaged_archive.7z - If files are listed, extract using the non-standard parser:
The
7z x -t* damaged_archive.7z-t*switch enables all parsers and attempts wild extraction across supported archive signatures inside raw data.