How to pass the password in "zip" terminal command?

With “zip” terminal command, is it possible to pass the password in the settings of a Shell.Execute() with ECHO command ?

Shell1.Execute("/usr/bin/zip -e ""echo """ + TextField.Text+ " " + destination + " " + source

I have an error 16 : wrong parameter in the command line and the message “stderr is not a tty”

Using -P password instead of -e

But there’s a catch, here is a warning the man pages says about typed data in one tty:

THIS IS INSECURE! Many multi-user operating systems provide ways for any
user to see the current command line of any other user; even on stand-alone systems
there is always the threat of over-the-shoulder peeking.

Thanks @Rick_A for infos. Yes, rather “zip -P”, you are right, but the question remains whole.

So the new answer, using -e, is no.

Maybe you should try the shell interactive mode.

it"s works fine now with -P option but but it seems to me that neither the Finder nor BetterZip app recognize the password ! is this normal?

I used

zip myfile.txt -P hello

and unzipped it in the Finder (that calls the Mac Archive Utility) without problems

Maybe you are using special chars that must be put in quotes as -P “hell@$wow”

Thanks @Rick_A , it seems to work with the -P parameter at the end!


The archive is created but the password is never recognized.
Anyone have an explanation or suggestion?

cmd = "/usr/bin/zip" + " "+ destination + " " + source + " " +  "-P " + "echo"  + TextField_Paswd_zip.Text

It works without “echo” command !