Couple of possibilities...
- One, as posted here, you have both M2_REPO and M3_REPO variables defined.
- Or you are facing this issue related to maven3 and M2_HOME
- The other is that somehow the JRE is getting used instead of JDK when run from the batch file!