3

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

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

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

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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