title: GNUPG - stdin encrypted file and passphrase on windows
body: <p>How can I pipe the passphrase and encrypted file in gpg.exe?</p>
  
  <p>I have tried a few different combinations but I can't get it to work.</p>
  
  <p>Here is my attempt,</p>
  
  <pre><code>C:\&gt;gpg.exe --output [OUTPUT_FILE] --batch --passphrase-fd 0 --decrypt &lt; [INPUT_FILE] &lt; [PASSPHRASE_FILE]
  </code></pre>
  
  <p>from this I get error</p>
  
  <pre><code>gpg: decrypt_message failed: eof
  </code></pre>
  
  <p>Swapping the input and passphrase around I get the error</p>
  
  <pre><code>gpg: no valid OpenPGP data found.
  gpg: decrypt_message failed: eof
  </code></pre>
  
  <p>If I don't try and send the encrypted file via stdin then the decryption works fine.</p>
  
  <p>Ultimately what I want to do is decrypt a file based on a file mask with the date timestamp in the file name. Outlined below,</p>
  
  <pre><code>C:\&gt;gpg.exe --output yyyyMMdd.csv --batch --passphrase-fd 0 --decrypt &lt; *_yyyyMMdd_*.txt &lt; [PASSPHRASE_FILE]
  </code></pre>
  
  <p>I'm not sure if this will work because I can't get the basic scenario working, I would also appreciate if someone could advise me of the best way to achieve this.</p>