Just now I faced the same issue.
In my case the problem was that PATH wasn't set properly to include %M2_HOME%\bin.
Once set properly, the problem was resolved.
When you face such issues, please print the value of PATH on the command line to ensure that it's properly picking up the values.