Windows XP PATH not interpreting environment variables

This one took me a while to figure out. I have my PATH environment variable set up to include other paths that are also defined by an environment variable. For example, I have Maven set up in the following way:


M2_HOME = C:\Program Files\Apache Software Foundation\apache-maven-2.0.9
M2 = %M2_HOME%\bin
PATH = %M2%;[a whole lot of other dirs]

Today, I tried to run a Maven build, and it wasn’t recognizing the maven\bin in my path. When I did an echo on my path, the path had the following:

%M2%;C:\Program Files...

instead of

C:\Program Files\Apache Software Foundation\apache-maven-2.0.9\bin

which would be the value of %M2%

When I did:

echo %M2%

I got the full path C:\Program Files\Apache Software Foundation\apache-maven-2.0.9\bin

What was going on?

Well, apparently, Windows has a limit on the size of your path and when it hits that limit, it just stops interpreting your %VARIABLES% set in the path.

So, the solution is to either reorganize all of your files into more succinctly named directories, or remove some of the dirs from your path.

Thanks M$. Hope this helps someone else.

3 thoughts on “Windows XP PATH not interpreting environment variables”

Comments are closed.