I am having a bad time with the standalone version of 7-Zip. I want to compress a folder with a password. I tried: 7za a my_folder -pmy_password
. It's compressing all the files in which 7za.exe is located with file name of my_folder.
BTW: I am using a scripting language called AutoIt.
As per Command Line Syntax (7zip.chm) > Contents > Command Line Version > Syntax :
7za <command> [<switch>...] <base_archive_name> [<arguments>...]
<arguments> ::= <switch> | <wildcard> | <filename> | <list_file>
<switch>::= <switch_symbol><switch_characters>[<option>]
<switch_symbol> ::= '/' | '-'
<list_file> ::= @{filename}
a is the command.
-pmy_password is a switch and should be therefore after the command and not at end. But switches can be also appended after base archive file name although this makes it more difficult to read and parse.
my_folder should be an argument, but is interpreted as base archive file name because you have not specified any archive file name.
So try:
7za.exe a -r -pmy_password MyArchive.zip my_folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With