Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to add C:\Program Files\Common Files\xxx\xxx to the system PATH environment variable by appending %CommonProgramFiles%\xxx\xxx to the existing path.

After rebooting, I open a command prompt and check the PATH. It expands correctly. However, when using Process Explorer from Sysinternals to view the Environment variables on services.exe, it shows the unexpanded version. Coincidentally, the paths using %SystemRoot% expand and are recognized just fine.

I've tried altering the PATH through the Environment Variables window from System Properties and through direct Registry manipulation, neither seems to work.

Is it possible to use other environment variables, besides %SystemRoot% in PATH and have services.exe understand it?

share|improve this question
    
Very odd. At least under Windows XP, it appears to expand environment variables other than %SystemRoot% just fine; for example, I have JAVA_HOME set and it is used in the PATH, and when I explore services.exe it has the expanded version. What version of Windows are you using? I assume you're using System variables, not User variables, correct? –  Daniel Jun 9 '10 at 23:32
    
I'm noticing this specifically on Windows XP Pro SP 3. You're correct, I'm using the system variables. Yeah, it is very odd. Your comment gives me some hope that it's at least possible :-) –  Brad Knowles Jun 10 '10 at 0:41
    
I'm using the same OS, XP Pro SP 3 - so that at least is probably not the issue. Can you try creating another system variable, like TEST=C:\blah, add it to the PATH as %TEST%, reboot, and then check the PATH on services.exe in Process Explorer? Just to see if it happens every time. –  Daniel Jun 10 '10 at 1:35

1 Answer 1

Now I had a similar problem a while back, and I am never sure if I solved it due to time constraints. Problem is here that there are spaces in expanded variable. I am not sure the %PATH% var handles that correctly. I noticed the same thing a while back, and I am pretty sure, like %ProgramFiles% as well, it does not work at all period. I suspect it might have something to do with properly escaping the space, and the fact that it cannot handle that. I tried it quoted long before seeing that on Microsoft Answers, only to notice it did not work when that was what I presumed to be the problem. You might be SOL, which is why I moved things like SysInternals tools into dedicated directories with simplistic paths where spaces and other things would not be an issue.

Remember, it's a feature, not a bug! Right?

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.