Adding an environment path to the Visual studio command prompt

Does the following add an environment path?

setx path "%path%;C:\foo"

It will leave any existing paths alone? i.e nothing will be deleted?

If I open the Visual Studio Command Prompt and run the above will it add an environment path to that applications properties or will it change the general command line's properties?


The proper syntax would be:

setx path %path%;C:\foo

This will append C:\foo to the PATH environment variable.

See this page for examples of the syntax.


Ok, so the more that I research this, and having tried it now in my local copy of Visual Studio 2010, it appears that setx doesn't work there. Following this link is the only Microsoft version that I can find http://technet.microsoft.com/en-us/library/cc755104(v=ws.10).aspx but it changes Server environment variables.

set path %path%;C:\foo appears to be your only option

To answer your question in the comments, doing a set in the command line does not permanently change things, it only changes them for the duration of your session.

If you want to change the environment variables for a Visual Studio project it looks like you have to do that in the project properties. http://msdn.microsoft.com/en-us/library/ms173406.aspx http://msdn.microsoft.com/en-us/library/ee479070(v=winembedded.60).aspx