Decrypt/Verify File in Kleopatra

I am trying my best to automate receiving a file from SFTP, renaming it, Decrypt/Verify file, execute the file in Scribe to import data to our system, and delete the file. I have done all of this in VBScript.

So far I have everything except for automating Kleopatra to Decrypt/Verify the file. I am not that great at coding and learning everything on the fly from Google and trial and error. So far i have this:

Dim oShell

Set oShell = WScript.CreateObject (“WScript.Shell”) Chr(34) & “C:\Program Files (x86)\GNU\GnuPG\kleopatra.exe” & Chr(34) & " -D --decrypt-verify \Different server\C$\Main\second\third\filetodecrypt.txt.pgp", 1, False

Set oShell = Nothing
Wscript.Sleep 5000

The above code opens Kleopatra and has the Decrypt/Verify window open. I noticed the Input file has double the slash marks and are facing the wrong direction. It tried to open:
////Different server//C$//Main//second//third//filetodecrypt.txt.pgp

Can anyone help me with the script for VBScript to Decrypt/Verify a file and then have Kleopatra close when finished? I also want the file that is saved to go in the folder that the encrypted file is located.

Please help as i am clueless

Hi Austin,
have you checked into
Many people use gpgme or call gpg.exe directly for automation.

Is there a a special need why you are calling Kleopatra?
Which verison of Gpg4win are we talking about?

Best Regards,

First thank you for taking the time to reply and assist.

I have been using Kleopatra since i started encrypting files and after checking the C:/…/…/GnuPG/ folder i do not have a gpg.exe or gpgme.exe file. I have a gpg2.exe and gpgme-w32spawn.exe file.

The version of Kleopatra i am using is:
Version 2.2.0-gitfb4ae3d (2015-11-12)
Using KDE Development Platform 4.13.3

Version 2.3.0

Dim oShell

Set oShell = WScript.CreateObject (“WScript.Shell”) Chr(34) & “C:\Program Files (x86)\GNU\GnuPG\kleopatra.exe” & Chr(34) & " -D --decrypt-verify //newfax/srtFtpData/Zeus/Advisory/ABCImport.txt.pgp", 1, False

Set oShell = Nothing

Wscript.Sleep 5000

I have that entered now which fixed the extra slashing issue. Now how can i get it to actually execute the Decryption? it opens Kleopatra with the correct file path now for import and save, but doesn’t run


please first upgrade to the latest Gpg4win version (which as of today is 3.0.3).

There you will have gpg.exe (it has been called gpg2.exe in older versions).

Kleopatra itself is for interactive use. If you do not require interactive use,
you will want gpgme (real integration) or for a very simple task, where api stability and error
reporting is not .an issue, you could try to call and run gpg.exe directly…

Best Regards,