I need to figure out how to decrypt from command line without gpg asking a popup to enter passphrase, I want to define that in the command line?
is it possible without having to create a batch file
please help
I need to figure out how to decrypt from command line without gpg asking a popup to enter passphrase, I want to define that in the command line?
is it possible without having to create a batch file
please help
Whether GnuPG asks on the command line or in a GUI prompt depends on whether gpg-agent
is used, and which pinentry
implementation is chosen. Sadly, there is no easy way to configure GnuPG to use a command-line prompt when used on the command line, and a GUI prompt otherwise as I already discussed in "GnuPG pinentry depending on GUI presence". Additionally, I'm not sure whether a command-line-only-pinentry implementation is available for Windows.
If you use GnuPG 1, you can simply choose --no-use-agent
to drop back to the command line. If you're using GnuPG 2.0, you need to provide the extra --batch
parameter, GnuPG 2.1 requires using gpg-agent
and you will have to drop back to workarounds like the ones proposed in the link above.
Another workaround is to use gpg-preset-passphrase
before calling gpg
to preset the passphrase to gpg-agent
, but you need to configure gpg-agent
appropriately and it seems gpg-preset-passphrase
is not available under Windows, but the same can be achieved by running gpg-connect-agent
. This might be viable when writing scripts, but does not seem a reasonable thing to use for day-to-day command line usage.
All in all, you might be better of configuring gpg-agent
to cache the passphrase for a while and accept you're queried on the GUI from time to time.