Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, is there a limit to how deeply environment variables can be nested in Windows? I do a lot of development work and I'm trying to set up my development environment vars, and a lot of them nest off each other, ie.




But I was having a heck of a time getting them to actually expand properly. For a while when I looked at the output of set, I was just getting what looked like they were being expanded in order and so any ones that depended on foo_ROOT weren't being expanded properly. I tried enabling delayed expansion and that didn't help, but restarting seemed to... so maybe delayed expansion required a restart..

Either way, I have GLEW_BIN_PATH and OSG_BIN_PATH in my PATH variable and they refuse to expand. This is really frustrating because the dll's are residing there and of course I can get evvvverything else to expand... any thoughts?

I have them in the PATH variable as:

[everything else....];%GLEW_BIN_PATH%;%OSG_BIN_PATH%

So I'm not seeing an obvious cause to keep them from expanding out..

Any suggestions?

share|improve this question

According to command prompt ignores any environment variables that are inherited from the parent process and are longer than its own limitations of either 2047 or 8191 characters (as appropriate to the operating system) May be length of your PATH with your "[everything else....];" exceeds this values?

Have you tried to add your variables to the start of %PATH%: e.g. %PATH%=%GLEW_BIN_PATH%;%OSG_BIN_PATH%;%PATH%;[everything else....];?

share|improve this answer
Hmm... no go. Interesting theory though. Looking through Path, %SystemRoot% (inside [everything else]) is being expanded... I'm really not sure what to make of this anymore... – trycatch Aug 30 '10 at 12:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.