Easiest is via Linux subsystem on Windows, but there would also be a way in Windows
#!/bin/bash
PASSPHRASE='YourStrongPassphrase123!'
# 1. Generate encrypted RSA private key in PKCS#8 format (.p8)
openssl genpkey \
-algorithm RSA \
-pkeyopt rsa_keygen_bits:2048 \