Just adding some more info that solved the problem for me:
- Make sure that the %M2% and %M2_HOME% variables doesn't have the semicolon (;) at the end. This should only be used if there are more than one location in that path, which is not the case;
- Also, make sure that in the "Path" variable, there aren't any spaces between the various paths, separated by the semicolon.
Thanks to Pawan Valecha and Abhijeet Sawant for the tips.