Forcing user environment variable

Aug 14, 2013 at 8:50 PM
I've discovered a mild 'gotcha' that I wanted to discuss - forcing 'C:\Chocolatey\bin;%APPDATA%\Boxstarter' into the User Environment Variable. It normally hasn't been a problem for me until I attempted to set up jobs for my Boxstarter packages in Atlassian Bamboo which is written in Java and uses the 'java wrapper' to run as a service. When a user environment variable exists, it overwrites/replaces the system environment. In this case it is %PATH% that's getting lost!! Deleting the user environment path, causes the java wrapper to once again pick up the system path and life is good.

This took a while to diagnose, the first symptom was that 'powershell.exe' could not be found. Unfortunately, it didn't surface until a full day later when I restarted the service for a different reason.

It's probably easy to blame the java wrapper for not behaving but it does raise the question of is it necessary to set the user's path? Why wouldn't we just use C:\Boxstarter globally as Chocolatey does and avoid the whole "user thing"?