Specifies password.
-p{password}
If a password is specified, and if the command creates or updates some archive (zip or 7z archive), 7-Zip will encrypt the data of the files in archive. But metadata (file names, file sizes, timestamps and other headers) will be stored without encryption, unless the additional switch -mhe is specified. If you want to encrypt both the data and the file names in a 7z archive, you must specify two switches: -p{password} and -mhe.
Note: 7-Zip doesn't support encryption of metadata (file names) for zip archives.
If -p switch is used without a password, 7-zip will prompt for a password during execution.
7z a -psecret archive.7z *.txt
compresses *.txt files to archive.7z using password "secret". File data will be encrypted, but file names will be stored without encryption.
7z a -psecret -mhe archive.7z *.txt
compresses *.txt files to archive.7z using password "secret". File data and file names will be encrypted.
7z x -psecret archive.zip
extracts all files from archive.zip using password "secret".
a (Add), d (Delete), e (Extract), rn (Rename), t (Test), u (Update), x (Extract with full paths)
Switches: -mhe (Enables or disables archive header encryption)