GPG - Is it possible to automate file decryption?

Hi. I can manually decrypt files using GPG4Win (Kleopatra). However, I need a way to automate this and handle multiple files. DOS Batch file is not working for me. Any suggestions? Much appreciated all,

I am not sure if I can help you all the way through but I would like to ask for a bit more info.

You want to “automate” the process? Does this mean you want a script to do this for you?
If you do want a script to do it, are you wanting to put the password hardcoded into the script?

Or would you just like to highlight say 10 files at once, then tell it to decrypt all 10 files at the same time?

The last option I should be able to help you with.

What version of gpg4win are you using?

Hi. My batch pulls down a new file each day from an FTP server. I want the new process to decrypt the file - a multi-file option would be nice since there could be more than one. A script sounds like a possible answer. I would like the password to be obscured (could possibly apply Windows file permissions). The Gpg4win version is 2.0.14. Thanks

Why does DOS batch file not work for you? You can schedule a DOS batch job or have it called by programs like TOAD Data Point as one step out of many in an ETL process. I have attached a sample batch file you would have to rename it from .txt to .bat for it to work.

Decrypt_Batch_File.txt (629 Bytes)

Well the version you are on, is probably perfectly fine. In fact it will probably be best to stay there because wildcards work such as *.gpg which you may need in your batch… newer versions the wildcard part is broken.

It seems what you are wanting to do is “do-able” but also difficult. It seems passing the passphrase through is not so simple… So I am pasting a couple sites that seem to explain it… maybe this will help.

Also while going through these remember different operating systems work differently when using command lines, just a heads up…

Check this:

And I also found this:

I am using the following DOS batch to encrypt files.
But to my knowledge it does not incorporate Kleopatra.
It simply calls GPG.

:: GPG folder directorys

:: Encrypt files in input folder

FOR %%F in (C:\INPUT*.xml) do call :PROCESS “%%F”

echo. Encrypt file %NAME% >> C:\log.txt

call gpg --yes --recipient certificateholder --encrypt --output %NAME%.pgp %NAME%

C:\windows\system32\ping -n 3 > nul