-p (set Password) switch

Specifies password.

Syntax

-p{password}
{password}
Specifies password.

Examples

7z a archive.7z -psecret -mhe *.txt

compresses *.txt files to archive.7z using password "secret". Also it encrypts archive headers (-mhe switch), so filenames will be encrypted.

7z x archive.zip -psecret

extracts all files from archive.zip using password "secret".

Commands that can be used with this switch

a (Add), d (Delete), e (Extract), rn (Rename), t (Test), u (Update), x (Extract with full paths)