Inside a batch file that I have some automation built, I have:
“gpg --local-user “USER” --sign “C:\FOLDERS*.txt””
on this line a prompt for the passphrase pops-up… is it possible to pass the passphrase in the bat file?
Save the passphrase in Kleopatra, or the reg?
Even if there would be a way for the prompt to ask for passphrase in CMD, rather than popping a window, I could then just add the passphrase entry in my bat…
You can put the passphrase or passphrase file name in your bat file. i.e. “C:\Program Files\GNU\GnuPG\gpg2.exe” --passphrase “your passphrase here (include quotes)” --batch -r KeyNameForDecryption --output “C:\Destination\Path\And\FileName%1” -d “C:\Source\File2Decrypt\Path\And\FileName%2”
%1 and %2 would be variable parts of the file name passed to the batch job when executed. You can also use a passphrase file:
instead of --passphrase “your passphrase”
You might need to do something like this if it is still prompting for a password:
echo MyPassphrase|gpg -o c:\Decrypted.txt --batch --passphrase-fd 0 --decrypt c:\Encrypted.txt.gpg that method pipes the passphrase into the input fd 0. (see this link for more help http://forum.winbatch.com/index.php?topic=681.0)
Thanks Greg, keep in mind I’m just trying to sign a file… I’m almost there with this:
gpg --batch --passphrase-fd 0 --local-user “USER” --sign “C:\FOLDERS*.txt”
I get a blank waiting cursor in the CMD, if I enter the passphrase here it works… but I’m not sure how to script entering the passphrase in this next step. (I’ve tried echo command, and I’ve tried just entering it as the next line in the bat.
Your help is appriciated! I need to have this automated this week! :S
The --batch needed to be there for the passphrase command to work, other wise I was getting “Passphrase is an invalid command”