12
I need a way to take a bunch of files and compress them into separate zip files, each with a password (the same password). I want to be able to do this in one simple step.
I have created a batch file that zips them each using 7zip, which worked like a charm, but didn't password protect them.
Is there a command I can add to the batch file that includes the password? Or alternatively - how can i create a batch file that will password protect the compressed files?
Thanks! If this is my batch file - where should i place that switch? for /d %%X in (*) do "c:\Program Files (x86)\7-Zip\7z.exe" a "%%X.zip" "%%X" – DAE – 2017-03-12T09:11:13.500
See the example in my answer :) – DavidPostill – 2017-03-12T09:12:11.057
but I'm not compressing .txt files, I'm compressing folders – DAE – 2017-03-12T09:15:20.487
@DAE That shouldn't matter.
"c:\Program Files (x86)\7-Zip\7z.exe" a "%%X.zip" -psecret "%%X\"
. – DavidPostill – 2017-03-12T09:17:46.230excellent- that answered the question. thanks! – DAE – 2017-03-12T09:19:47.950
2beware that this puts the password in your command history. On Windows, this should persist for the current shell, but on *nix, it typically persists longer. additionally, the command line is visible all other processes on the system for the duration of the process execution. If any untrusted software is on the system, you may have just given it your secret. – atk – 2017-03-13T03:54:04.803
Any idea what to do if this results in "The parameter is incorrect"? It's related to the mhe flag, which I want to use but I can't get it to work. – nasch – 2018-06-29T01:17:16.427