I need to execute a commandline like this:

C:\>gpg --output criticalToAdam2.gpg --encrypt --recipient 08C683ca critical.docx

To a specific folder, for example: MyHappyFolder\AnotherFolder

How can I accomplish that without more than one command line, like "cd MyHappyFolder\AnotherFolder" ?

migrated from security.stackexchange.com Aug 11 '16 at 15:29

This question came from our site for information security professionals.

  • Does adding the filepath not work properly? Like C:\ > gpg --output MyHappyFolder\AnotherFolder\criticalToAdam2.gpg --encrypt --recipient 08C683ca critical.docx . Gotta ask the obvious questions first. – INV3NT3D Aug 11 '16 at 13:03
  • 1
    sorry not to mention the obvious, it is always good to be clear. Yes I tried that from the beginning, it doesnt work, thanks – RollRoll Aug 11 '16 at 13:05
  • Would creating a script work for your situation? You could have batch file that CD's and then runs the gpg command. – INV3NT3D Aug 11 '16 at 13:14
  • 1
    I checked that in Linux, both full and relative paths work just fine with --output. Perhaps this is a windows issue? Try full paths, and try /-s instead of `\`-s. If all fails, add a windows tag. :D – Matei David Aug 11 '16 at 15:38

I believe the answer might be found here, and it involves problems with Posix to Win32 path conversion. Instead of MyHappyFolder\AnotherFolder, try:


Encrypt with password:

gpg -o /tmp/Linux.pdf.gpg -c Linux.pdf

Encrypt with key:

gpg -o /tmp/Linux.pdf.gpg -e -r "UID_or_Email" Linux.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.