Adding a directory to the PATH environment variable in Windows

command-line, environment-variables, path, windows

Solution

This only modifies the registry. An existing process won't use these values. A new process will do so if it is started after this change and doesn't inherit the old environment from its parent.

You didn't specify how you started the console session. The best way to ensure this is to exit the command shell and run it again. It should then inherit the updated PATH environment variable.

Problem

I am trying to add `C:\xampp\php` to my system `PATH` environment variable in Windows. I have already added it using the Environment Variables dialog box. But when I type into my console: ``` C:\>path ``` it doesn't show the new `C:\xampp\php` directory: ``` PATH=D:\Program Files\Autodesk\Maya2008\bin;C:\Ruby192\bin;C:\WINDOWS\system32;C:\WINDOWS; C:\WINDOWS\System32\Wbem;C:\PROGRA~1\DISKEE~2\DISKEE~1\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;D:\Program Files\TortoiseSVN\bin ;D:\Program Files\Bazaar;C:\Program Files\Android\android-sdk\tools;D:\Program Files\ Microsoft Visual Studio\Common\Tools\WinNT;D:\Program Files\Microsoft Visual Studio\Common \MSDev98\Bin;D:\Program Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\ Microsoft Visual Studio\VC98\bin ``` I have two questions: - Why did this happen? Is there something I did wrong? - Also, how do I add directories to my `PATH` variable using the console (and programmatically, with a batch file)?

Original source

Related problems