Step 1. Open Help==>Debug Windows==> console tab in Desktop Wallet 

Step2 . Just use "dumpwallet /path/to/dumpwallet.txt" in the QT Wallet Console 

dumpwallet /path/to/dumpwallet.txt


For Mac/Linux user: Example dumpwallet 


For windows user : Because security setting you should dump your wallet to your home folder:  dumpwallet "C:/Users/YOUR-USERNAME/dumpwallet.txt"


Example

dumpwallet "C:/Users/hoangton/dumpwallet.txt"


The command will export every of your private keys into that text file. 


P/s: in case you have encrypted Wallet before you need run this command before run dumpwallet 

walletpassphrase "your pass phrase" 600


replace "your pass phrase" with real your passphrase that you used to encrypted your wallet