Make sure that you haven't renamed some folder which falls in the path of the M2
environment variable. In case you have, then change your M2
and/or M2_HOME
accordingly.
It doesn't matter whether M2
or M2_HOME
are System Variable or User Variables as long as you are logged in with the same user under whose scope the environment variables are.