How do I add an environment variable so I can run an EXE from any folder in the Windows command line?

I went to Environment Variables in the Advanced tab of System Properties and added a new System variable like this:

name: msbuild35
value: C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe

but when I try to run msbuild35 I still get the 'not recognized...' message

What am I missing?


Solution 1:

You need to add ;C:\Windows\Microsoft.NET\Framework\v3.5\ to the end of the PATH environment variable.

You will likely need to close and reopen your command line window for the changes to take effect.

Solution 2:

Open the Environment Variables dialog from the Advanced tab of System Properties again and do the following.

  1. Delete msbuild35 that you created earlier; it is not necessary
  2. Look for the Path variable in both sections (user and system)
  3. If there is one in the user section, please let us know since that is unusual
  4. Select the Path variable from the System Variables section and click Edit
  5. Look for C:\Windows\Microsoft.NET\Framework\v3.5 in the value field of the dialog (you may want to copy the contents of the field to Notepad to make it easier to examine)
  6. Verify that there is a semicolon before it, and if it is not the last item, after it as well
  7. Click OK, OK, OK
  8. Reboot
  9. Open a command prompt and type msbuild
  10. Let us know if it still does not work