Command line and private key popup 1st time


i am trying to use command line to decrypt files with gpg4win latest version but this popup is annoying since i can’t run this in auto decryption mode because of this. It’s obvious that i need to enter key once and then i can use it as long as agent is running. There is no gpg-preset-passphrase for windows so i wonder how can i permanently enter passphrase to agent or any other workaround to avoid 1st time popup would be very welcomed.


From the command line you can include the passphrase. Try something like this:

“C:\Program Files\GNU\GnuPG\gpg2.exe” --passphrase “your passphrase here (include quotes)” --batch -r KeyNameForDecryption --output “C:\Destination\Path\And\FileName%1.txt” -d “C:\Path\for\sourceFile\And\FileName%1.txt.gpg”

%1 could be a variable timestamp added to the file name passed into the batch job (or left out if not needed). This format should not prompt.

Decrypt_Batch_File.txt (629 Bytes)


i know about --passphrase but when i 1st time use it i get that popup and it ignores password that i specified inside command line. That is actually what bugs me. In version 1 i could use passphrase every time and it worked fine.

If you don’t need the protection, just remove the passphrase.

I do need protection, it’s a file encrypted by someone else and uploaded to FTP. If i could resolve that 1st decryption popup (i think agent handles passphrase caching) i solved the problem but don’t know how to resolve it :frowning:

I am talking about your private certificate.
If you want to run it in an internal script and it is okay, that there is no
manual giving of the passphrase you can just remove the passphrase
of your private certificate (by using an empty one).

Then the script or anyone that can read your private certificate can use it,
e.g, for decryption of the transported file.


thank you for the tip! I think that should be viable solution. Let me try and test.

I can’t set black password. When i tried to set blank password over Kleopatra it gives me several warnings and in the end i get “Not supported”.

Hmm, try the command line.

Yes, command line worked and it doesn’t ask me anymore for password during decryption.

Very helpful!