GPG4Win Advice

Peter Lebbing peter at
Sun Jun 11 21:53:20 CEST 2017

On 08/06/17 16:39, Ian A Morris wrote:
> When using the GUI there are options for the following, “Remove
> unencrypted original file when don”

This is an extra convenience added by the GUI program. It is not in the
command line interface.

> Gpg2 –batch –recipient /xxxxx / –encrypt-files –armor C:\Location\*.txt

The simplest way is to follow this by
> del C:\Location\*.txt

but this introduces a race condition. So it's probably better to do
something like

for x in C:\Location\*.txt
gpg2 ... --encrypt $x
del $x

However, it's been many years since I last did anything with
MS-DOS/Windows batch files and I don't have the correct syntax ready. It
needs to bail out when gpg2 errors, but that is way beyond my limited
recollection of batch files.

Oh, and when building a gpg command line, you're supposed to put options
before the command. However, it does try to cope with people putting
options after the command. (And in the quote above, my e-mail client
ended up putting an en-dash where there should be two ascii dashes,
which kinda spoils the didactic value.) I'd suggest the following
command line:

> gpg2 --batch --recipient XX --armour --encrypt-files C:\Location\*.txt

I see you're mailing from a .UK address, so I thought I could point out
armour can be spelled with British spelling as well :-). --armor works
just as well.



I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20170611/0a6a1903/attachment.sig>

More information about the Gnupg-users mailing list