another windows batch question

Chris Fox dissectingtable at
Fri Feb 6 15:44:51 CET 2004

Hash: SHA1

Jonathan Goulding wrote:

| Hi,
| I would like to avoid the 2 following:
| 1. writing data to/from files;
| 2. using named pipes to have a program interact with gpg
| So is it possible to call a batch file passing it both the data to be
| encrypted/decrypted and the passphrase, so I don't first have to write
| the data to a file and then call the batch?
| -Jonathan Goulding
| P.S. The reason #2 is not satisfactory is that I am using VB and I
| understand that task is quite difficult/impossible to do in VB.  Also, I
| am a law student, not a programmer; so, while I enjoy teaching myself
| how to program, I would hardly describe myself as a prodigy.

If you always encrypt to the same recipient you can add a
default-recipient line in your gnupg.conf file and your batch file
reduces to:

@echo off
if "%1" == "" goto syntax
type %1 | gpg -ea > %1.gpg
goto done
echo syntax: enc filename
echo writes filename.gpg

If you don't have a default recipient it will prompt you on stderr and
the batch file still works.
- --
Chris Fox, Windows User, Linux User (#341856), non-partisan
"[The multiplicity of reality at large] is an inescapable consequence of
[quantum theory's] allowing superpositions of what classical physics
would regard as mutually exclusive alternatives."
~ -- Michael Lockwood /Brit. J. Phil. Sci./ (1995)
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla -


More information about the Gnupg-users mailing list