3

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?

Paul T.
  • 119
  • 6
Brad Knowles
  • 71
  • 1
  • 3
  • 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 Waechter Jun 09 '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 00: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 Waechter Jun 10 '10 at 01:35

1 Answers1

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?

songei2f
  • 1,934
  • 1
  • 20
  • 30