Batch Decrypt With GNU GPG

One question frequently asked in GPG news groups is "How do I decrypt more than one file at a time?"

Steps

  1. Make sure you have a working GNU GPG installation.
  2. Know your passphrase.
  3. In Windows go to the command Prompt. This is either Start|Run Command or CMD depending on your Windows version.
  4. In Windows Command Prompt change directory until you are in the directory with the files you wish to decrypt.
  5. Use this command: echo thisismypassphrase|gpg --batch --passphrase-fd 0 --decrypt-files *.gpg (or *.pgp, or *.asc depending on the files)
  6. It is important to note there is NO SPACE after your passphrase and the pipe. The echo command sends your passphrase to GPG when GPG requires the passphrase.

Tips

  • See http://www.gnupg.org/ for more information
  • If your files are named something like file1.gpg file2.gpg and you know what the real ext should be (like .txt or .doc, etc) you can rename them all with the following command: ren *.gpg *.txt.gpg.
  • NOTE: this will change any file in that directory with .gpg ext to .txt.gpg. So be careful! One reason to do this is if you use GPG it will decrypt File.gpg to File with no ext. There are command line phrases to get the embedded file name from the file but you can find that out on http://www.gnupg.org

Warnings

  • thisismypassphrase = YOUR passphrase. Don't tell anyone the passphrase unless they have your youngest puppy hostage, even then think twice about it!

Related Articles

You may like