Skip to main content
The t (test) command verifies the integrity of archives by checking checksums and attempting decompression without writing files to disk.

Syntax

Description

The test command:
  • Verifies archive structure and headers
  • Checks CRC checksums for all files
  • Tests decompression without extracting to disk
  • Detects corruption, errors, or incomplete archives
  • Works with encrypted archives (requires password)
  • Can test specific files or entire archives

Common Options

string
required
Name of the archive to test. Auto-detects archive type.
string
Specific files or patterns to test. If omitted, tests all files.Example: *.txt or documents/report.pdf
string
Provide password for encrypted archives.Example: -pMyPassword or -p (prompts)
flag
Recurse subdirectories (enabled by default).
string
Exclude files from testing by pattern.Example: -x!*.tmp
string
Include only files matching pattern.Example: -i!*.txt
string
Specify archive type (usually auto-detected).Example: -t7z
string
Set hash function for testing: CRC32, CRC64, SHA256, SHA1, etc.Example: -scrcSHA256
flag
Disable progress indicator.
number
Set output log level (0=quiet, 1=errors, 2=errors+warnings, 3=verbose).

Examples

Test entire archive

Output (success):
Output (failure):

Test password-protected archive

Prompts:
Or provide password directly:

Test specific files

Test files by pattern

Test excluding certain files

Test quietly (exit code only)

Test with verbose output

Test multi-volume archive

Automatically tests all volumes.

Test multiple archives

Test with SHA256 checksums

Exit Codes

The test command returns exit codes that indicate test results:

Testing Strategies

Quick Test Script

Test All Archives in Directory

Test and Log Results

Test Before Extraction

Only extracts if test succeeds.

Advanced Examples

Test with progress to file

Test and capture errors

Parallel testing of multiple archives

Test archive chain

Understanding Test Results

Successful Test

All files passed CRC check and decompression.

CRC Error

File’s checksum doesn’t match. File is corrupted.

Data Error

Decompression failed. Archive data is corrupted.

Headers Error

Archive structure is damaged.

Wrong Password

Incorrect password provided for encrypted archive.

Unsupported Method

Archive uses compression method not supported by this 7-Zip build.

Testing Different Archive Types

Test ZIP archive

Test RAR archive

Test TAR.GZ archive

Test ISO image

Test self-extracting archive

Test split archive

Automated Testing

Cron Job for Regular Testing

Test with Timeout

Test and Compare Checksums

The test command reads and decompresses files but does not write them to disk, making it safe to run on any archive without worrying about disk space or file conflicts.
A successful test does not guarantee that files will extract properly in all cases. It only verifies CRC checksums and basic decompression. Physical media errors during extraction could still occur.
Always test archives after creating them, especially before deleting source files:

Performance Considerations

  • Testing is faster than extraction (no disk writes)
  • Solid archives must decompress sequentially (slower)
  • Multi-volume archives test faster with all volumes present
  • Encrypted archives require full decompression (slower)
  • Password-protected headers require password even for testing