Gpg4win command line

I was wondering if it’s possible to use UNC pathing when running gpg.exe command line
I have a client that’s insisting on using a network directory to store files
where they need to be signed / ecrypted
If I do a drive mapping it works fine, but they don’t want to do that
they want to use
\server\path is there any chance of doing this?

Yes, you can use UNC paths. Something like this should work:

“C:\Program Files\GNU\GnuPG\gpg2.exe” --passphrase “your passphrase here (include quotes)” --batch -r KeyNameForEncryption --output \Server\Destination\Path\And\FileName.gpg -e \Server\DestinationPath\FileName

If there are spaces in the folder or file name put quotes around the whole path\fileName.

my command was
gpg.exe --armor --batch --yes --passphrase-file “\lexjuror2k1\scot\juror\jpmc\export\p.txt” --output “\lexjuror2k1\scot\juror\jpmc\export\doccts.efs.enroll.2014048_1305.asc” --local-user --sign “\lexjuror2k1\scot\juror\jpmc\export\doccts.efs.enroll.20140408_1305”

i get the following error
gpg: can’t open ‘\\lexjuror2k1\scot\juror\jpmc\export\p.txt’ : no such file or directory

it seems to be doubling all the backslashes.
I’ve tried with single quotes… double quotes. I tried with additional backslashes.
nothing seems to work

can you see the file p.txt in folder \lexjuror2k1\scot\juror\jpmc\export\ using windows explorer? (might be an access issue). Also try it without the quotes as you have no spaces in the folder names. I did not use a UNC path for the passphrase but it worked on Windows 7 with the UNC paths for the output and encrypt file locations. What OS are you using?

yes, the p.txt file exists on the network drive.
I pointed it, to the local drive/directory for the p.txt file
but… then, I get can’t open
‘\\lexjuror2k1\scot\dc\jpmc\export\DOCCTS.EFS.ENROLL.20140116_0830’‘’ : No error
gpg: signing failed : system error w/o errno

I had tried to put the path in single and double quotes, and got the same results for both

Try this:


Also try copying the above and pasting it into widows explorer address bar and see if it opens the file.

Sorry, I did not look carefully at the prior posts. It looks like it is finding your passphrase file with the UNC path. Now you are having trouble signing it. It might work without signing (I don’t use signing so I am not that familiar with this part), but make sure you can open the signing file also (I noticed it is not a .txt file) It should open when you paste the path and name into Windows exporer, even if not readable.

Also I noticed you don’t have an -e or --encrypt command. Try:

gpg.exe --armor --batch --yes --passphrase-file “\lexjuror2k1\scot\juror\jpmc\export\p.txt” --output “\lexjuror2k1\scot\juror\jpmc\export\doccts.efs.enroll.2014048_1305.asc” --local-user --encrypt --sign “\lexjuror2k1\scot\juror\jpmc\export\doccts.efs.enroll.20140408_1305”

Good luck!