7-Zip Solid Archive Command Line Switch Guide
This guide explains how to enable solid archive mode using the 7-Zip command line utility. You will discover the exact switch syntax needed to activate solid compression, understand how the feature improves compression ratios, and review practical command examples for your archiving workflows.
The Solid Archive Switch:
-ms
In the 7-Zip command line tool (7z), the switch used to
manage solid archive mode is -ms.
To explicitly enable solid archive compression, use:
-ms=on
While solid mode is enabled by default when creating .7z
archives, explicitly defining -ms=on ensures the mode is
active regardless of any default configuration overrides.
Basic Command Syntax
To create a new solid archive from a folder or set of files, use the
a (add) command combined with the -ms=on
switch:
7z a archive.7z C:\path\to\files\* -ms=onHow Solid Archive Compression Works
Standard archiving compresses each file individually. In contrast, solid compression treats multiple files as a single, continuous data stream. This allows the compression algorithm to reference patterns across different files rather than only within individual files.
Solid archiving is particularly effective when compressing:
- Large sets of similar files (e.g., text logs, source code repositories).
- Multiple versions of the same file.
- Collections of small files with shared headers or data structures.
Advanced -ms Switch
Options
The -ms switch allows granular control over how solid
blocks are organized:
- Disable Solid Mode: Use
-ms=offto compress each file independently. This speeds up the extraction of single files later, though it reduces the overall compression ratio. - Limit by Solid Block Size: Use
-ms=[size]to limit the size of a solid block (e.g.,-ms=2gfor a 2 GB block size limit, or-ms=500mfor 500 MB). Limiting the block size balances compression efficiency with extraction speed. - Limit by File Count: Use
-ms=eto group files with the same extension into their own solid blocks, or specify a file count limit using the format-ms=[number]f(e.g.,-ms=100flimits solid blocks to 100 files).
Example with Block Size Control
To create a solid archive where files are grouped into 4 GB solid blocks:
7z a project_backup.7z ./project_data/* -ms=4gUsing the -ms switch gives you direct control over
memory usage, extraction speed, and final file size when automating
7-Zip archives.