Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 0 down vote accepted

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 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.

share|improve this answer
I assume the environment variables for Command Line and VS Command Prompt are different? If I have VS Command Prompt open and run this code it will specifically amend the VS Command Prompt's variables i.e not the normal command line's variables? – whytheq Oct 5 '12 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .