Agent does not see System Environment Variables

I have environment variable  %PATH% specified for all users when I run simple batch script ("set path") using "Command Line" build step , I see variables only for particular user.
But then I run this script from cmd.exe - it works fine.
Is it expected behavior? Can I change it?
Thank you.

Comment actions Permalink

are the build agent and interactive cmd.exe session started under the same user account?
If variables were changed recently, you need to restart agent service to refresh its environment.

Comment actions Permalink

Then I login use this account ,open cmd.exe and run "set path" I see all paths (System+User) but then I run this command from build step I see only user part of PATH variable.
On "Agent.Environment Variables" page ("agentDetails.html?id=1&tab=agentParameters&kind=env") I see the same.
Screenshots attached.

Comment actions Permalink

thank you for detailed explanation.
Unfortunately this is a bug in a service wrapper we use to launch build agent process.
It's filed in TW-2266, please vote.

As a workaround I could suggest to delete user-level variable and list all paths on system level.


Comment actions Permalink

It works! Thank you. It was very strange workaround. :)


Please sign in to leave a comment.