In Windows 7 I set the PATH environment variable thus:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%JAVA_HOME%\bin;%M2_HOME%\bin;%ANT_HOME%\bin;R:\bin;P:\bin;C:\Program Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program Files\SlikSvn\bin\;C:\Program Files\TortoiseSVN\bin
When I log out and log in, and then bring up a command prompt, all my environment variables are properly expanded---except M2_HOME. If I bring up the edit window for the PATH environment variable and simply hit OK with no edits, when I open up a command prompt the M2_HOME variable is properly replaced, and remains so until I log out.
I don't understand this. Even if this were a definition order problem, M2_HOME appears before PATH alphabetically. What's going on?