Install the force.com CLI, confirm it runs from your current working directory by running ‘force’
  1. Install the force.com CLI, confirm it runs from your current working directory by running ‘force’
  2. Install PMD, confirm it runs from your current working directory by running PMD

Then, run the following commands in sequence

cd <target directory>
mkdir metadata
force login
force export ApexClass
pmd -d metadata\classes -R rulesets/apex/ruleset.xml -f html -reportfile report.html
report.html 

I then cut and paste the report.html contents from browser to Excel for subsequent review and processing.