4

I'm trying to set new environment variables to any new child-process in Windows platforms.

For example. I'm using sublime, and I run the build command from sublime. (The build command may be a BAT file.)

I want to change the PATH, and I want all new build processes to use the new path. But sublime uses the old path, and the build process inherits this.

1 Answers1

0

It appears to be impossible to modify the environment of a running process unless you attach as a debugger or profiler. It's also a bad idea. Programs are usually designed to check environment variables once and not continually check if they were modified. Unless you manage to get the variable changed in the few ms before the process read the environment, your change would go unnoticed.

It'd be far better to get sublime is to properly accept the new PATH; or to have sublime run a script file (BAT, Powershell, whatever) that first sets the PATH and then executes the build process.

Ross Presser
  • 1,470