Command Line Parameters


I would like to know how to supply the passphrase on the command line so that I am not prompted to enter it as I need to automate the decrypting of files using the command line.

I am using the following command line:

gpg -o d:\temp\myfile.txt -d d:\temp\myfile.pgp



I found the answer in the MAN pages so here is the answer:

gpg --passphrase mypassphrase --batch -o d:\temp\myfile.txt -d d:\temp\myfile.pgp

You must include the “–batch” option otherwise the passphrase option is ignored and you are prompted instead. There is also an option for including the passphrase in a file:

gpg --passphrase-file c:\test\mypassphrase.txt --batch -o d:\temp\myfile.txt -d d:\temp\myfile.pgp