Put information for gen key in a text file, eg. gpg_gen_key:
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: My Name
Name-Email: [email protected]
Expire-Date: 0
Passphrase: secretpass
Gen key with above text file:
gpg --batch --gen-key gpg_gen_key