Encrypt a file via the CLI?

Hello, guys!
Could you tell me please, is there a way to encrypt a file via the CLI?

Hi Joe,
sure there is. For OpenPGP the main command line application is “gpg”.

Something like this should work:

gpg --encrypt --verbose --recipient BDD957F9C4FE0FDC583DCD6D2B7BA3BF9BC3A554 hello.txt

(Check the manual for the details :wink: )


Thank you! Where I can get the manual? Give me a link, please.

Hi Joe,

the technical manuels for the crypto engines are online here:
but this is the newest version, which is sometimes newer than the version
installed with the current Gpg4win. For many things that is still good enough.


There are a few good videos on Youtube which show you the basic commands. Most of these videos are poor.

This is one one of the better ones and starts by telling you how to set up the keys by command line, which is shown in Linux. But the commands are the same for Windows. The actual encryption commands are shown about 5 minutes in.