mina
mina

Reputation: 449

How can I make Visual Studio learn of new environment variables without having to restart my system

I've seen posts asking about how to get environment variables to be refreshed without having to close VStudio, but for me, I just want to know how I can make the changes without having to restart my system. I really don't understand how it can't detect the new changes - I've totally made sure the process is not hanging around and even used the vcvars32.bat to pick up new changes before re-opening. I can't find a solution. My environment variables can be used from elsewhere (ie. %variablename% works in cmd.exe). Any ideas?

Upvotes: 7

Views: 9280

Answers (2)

Michael Burr
Michael Burr

Reputation: 340366

Since the new environment variable is visible in the cmd window, why not start VS from there? The devenv command will start the VS IDE. You can tell it to load a particular solution or project.

devenv  [solutionfile | projectfile | anyfile.ext]  [switches]

The VS IDE will pick up the environment variable state that's in effect in that cmd window. However, note that certain environment variables will not be picked up unless you use the /useenv option:

  • /useenv: Use PATH, INCLUDE, LIBPATH, and LIB environment variables instead of IDE paths for VC++ builds.

Also note that it also accepts a bunch of options (mainly to build projects from the command line); use devenv /? to get details.

Upvotes: 3

Brad Bruce
Brad Bruce

Reputation: 7827

The environment that is being used is the one from windows explorer. You would have to restart explorer for the changes to appear.

There is a way to apply the changes to the current environment. You might want to try SuperUser.com

Upvotes: 8

Related Questions