If you are trying to decrypt a file or a bunch of files using batch file in windows you will write something like this:
gpg --pinentry-mode=loopback --batch --yes --passphrase "abc%123" --decrypt-files *.pgp
and you put the above code in a .bat file and run it but you got an error like:
gpg: public key decryption failed: Bad passphrase
You are 1000% sure the passphrase is correct .. well the problem is in the passphrase itself as it contains a special character that needs to be escaped .. in the above example , the passphrase : “abc%123” must be written like this: “abc%%123” as %% is the escape of % … for a complete list of batch file escape characters , check this link
in case if you are wondering about the meaning of
it is used to prevent the gui from pooping up and asking for the passphrase.
Another important point , to make the batch option work without problem .. you have to make sure that the encrypted file extensions is *.pgp