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.
Just like any other environment variable, with :SET
SET PATH=%PATH%;c:\whatever\else
If you want to have a little safety check built in first, check to see if the new path exists first:
IF EXIST c:\whatever\else SET PATH=%PATH%;c:\whatever\else
If you want that to be local to that batch file, use :setlocal
setlocal
set PATH=...
set OTHERTHING=...
@REM Rest of your script
Read the docs carefully for /setlocal , and have a look at the other references on that site - Functions is pretty interesting too and the syntax is tricky.endlocal
The Syntax page should get you started with the basics.
Firstly, check your original path:
echo $PATH
It should show something like this:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Now add your program to that path, ensuring your using the entire path all the way from / to your program.
export PATH=$PATH:/path/to/my/program
This sets your PATH variable to the existing PATH plus what you add to the end. Check that it has been added (Caveat: it presist only in the current session of the terminal):
echo $PATH
For Mac/Linux;
PYTHONPATH=/foo/bar/baz python somescript.py somecommand
For Windows, setup a wrapper ;pythonpath.bat
@ECHO OFF
setlocal
set PYTHONPATH=%1
python %2 %3
endlocal
and call script file like;pythonpath.bat
pythonpath.bat /foo/bar/baz somescript.py somecommand
That's not really how the variable works.path
If you add a directory to the path variable, you don't have to change to the directory to execute a program.
For example,
C:\>set Path=C:\Program Files (x86)\MyProgram\modules\bin;%Path%
C:\>program
will execute .C:\Program Files (x86)\MyProgram\modules\bin\program.exe
If you just want to store a directory's name in a variable (which shouldn't be ), you can do this:Path
C:\>set myBin="C:\Program Files (x86)\MyProgram\modules\bin"
C:\>cd %myBin%
C:\Program Files (x86)\MyProgram\modules\bin>
If you want to set an environment variable for all command prompts (without having to enter ), you can do so inset...
Computer [right click] -> Properties -> Advanced System Settings -> Environment Variables
Control Panel, System, Advanced tab, Environment Variables (Windows XP). Edit PATH:
PATH=C:\Python26;C:\Windows;.... etc.