Finding PATH

W

W. eWatson

I want to add something to PATH. Where do I find it? Probably Properties
of something.
 
B

Bob I

Control panel, System, Advanced System settings, Environment Variables
(same as W2K, XP and Vista)
 
V

VanguardLH

W. eWatson said:
I want to add something to PATH. Where do I find it? Probably Properties
of something.
Which one? The system environment variable PATH? Or the user
environment variable PATH? The former is the string used for all users
with the user's PATH appended onto it when they login. The latter is
the user's PATH string and is different for each user login.

Path = <systemPATH>+<userPATH>

If you want to edit the Path environment variable only for the shell in
which you are in, like a console window (aka command prompt), run "set
PATH" or "echo PATH" to see its current system+user value. You can edit
that path in that shell using "set PATH=<value>". If you intend to
prepend something the PATH then use "set PATH=<value>;%PATH%"
(environment variables enclosed in percent sign delimiters return their
current value, so you end up setting PATH to a string you prepend to the
current PATH value). Similarly, if you want the paths in the current
PATH variable to have priority over your added paths, then append your
string using "set PATH=%PATH%;<value>". Remember to use the semicolon
as the delimiter in the string to separate the paths you are including.

The above is important if you are adding something to the PATH variable
but doing so only within the confines of a script file, like a .bat
file, that you run. The batch file, as with all other programs, run
within their own shell and will copy the global PATH value into their
shell but you might want to use a new value or modify the imported one
in the script you run in a new shell. For example, you might have in a
..bat file:

echo off
cls
....
set path=c:\batch;%path%
....

When you run the .bat file, its shell get the global value of the PATH
environment variable, the c:\batch path gets added (say because you call
multiple .bat files inside that .bat file and put them all in that
folder), the rest of your .bat file executes, and when the .bat file
exits then its shell vaporizes and the changed value of PATH for that
shell also vaporizes (i.e., the change to PATH is only effected during
the existence of the shell).

If you are looking to change the global PATH values for all shells
(every program runs within one) then follow Bob's suggestion. By
default, only the system PATH variable is defined. The user PATH
variable is not yet defined. What you get in the shell for a program
will be the combination of the two: system PATH + user PATH. If you
want the change to PATH to be effected in all shells then you modify the
system variable. If you want the modification to PATH to be effected
only under your Windows account you logged into then modify the user
PATH variable.

For changing the global PATH variables, I believe you must be logged
under an admin-level account to change the system PATH variable. When
you change the global (system + user) environment variables, the changes
are effected immediately. That is, any *new* programs you load will see
the new value(s). However, any currently running programs will not see
the changes. You have to restart those programs so they run inside of
new shells to get the newly modified values of those environment
variables.
 
W

W. eWatson

Which one? The system environment variable PATH? Or the user
environment variable PATH? The former is the string used for all users
with the user's PATH appended onto it when they login. The latter is
the user's PATH string and is different for each user login.

Path =<systemPATH>+<userPATH>

If you want to edit the Path environment variable only for the shell in
which you are in, like a console window (aka command prompt), run "set
PATH" or "echo PATH" to see its current system+user value. You can edit
that path in that shell using "set PATH=<value>". If you intend to
prepend something the PATH then use "set PATH=<value>;%PATH%"
(environment variables enclosed in percent sign delimiters return their
current value, so you end up setting PATH to a string you prepend to the
current PATH value). Similarly, if you want the paths in the current
PATH variable to have priority over your added paths, then append your
string using "set PATH=%PATH%;<value>". Remember to use the semicolon
as the delimiter in the string to separate the paths you are including.

The above is important if you are adding something to the PATH variable
but doing so only within the confines of a script file, like a .bat
file, that you run. The batch file, as with all other programs, run
within their own shell and will copy the global PATH value into their
shell but you might want to use a new value or modify the imported one
in the script you run in a new shell. For example, you might have in a
.bat file:

echo off
cls
...
set path=c:\batch;%path%
...

When you run the .bat file, its shell get the global value of the PATH
environment variable, the c:\batch path gets added (say because you call
multiple .bat files inside that .bat file and put them all in that
folder), the rest of your .bat file executes, and when the .bat file
exits then its shell vaporizes and the changed value of PATH for that
shell also vaporizes (i.e., the change to PATH is only effected during
the existence of the shell).

If you are looking to change the global PATH values for all shells
(every program runs within one) then follow Bob's suggestion. By
default, only the system PATH variable is defined. The user PATH
variable is not yet defined. What you get in the shell for a program
will be the combination of the two: system PATH + user PATH. If you
want the change to PATH to be effected in all shells then you modify the
system variable. If you want the modification to PATH to be effected
only under your Windows account you logged into then modify the user
PATH variable.

For changing the global PATH variables, I believe you must be logged
under an admin-level account to change the system PATH variable. When
you change the global (system + user) environment variables, the changes
are effected immediately. That is, any *new* programs you load will see
the new value(s). However, any currently running programs will not see
the changes. You have to restart those programs so they run inside of
new shells to get the newly modified values of those environment
variables.
The environmental variables. I'm installing MinGW's fortran compiler.
Their instructions actually spell it out clearly. I missed it the first
time I looked. A quick check of the shell (linux-like) tells me I'm OK.
 
A

Andrew Rossmann

Control panel, System, Advanced System settings, Environment Variables
(same as W2K, XP and Vista)
There are 2 areas to put it. The upper window will only add it to that
user's login. The lower one will add it for everybody (if you have the
permissions to change it.)
 
J

Jack

I want to add something to PATH. Where do I find it? Probably Properties
of something.
Control Panel, System & Security, System, Advanced System Settings,
Enviroment Vars, Path, Edit.
 
J

Johannes A Van KootenIN THE UK SINCE LATE 80s

"Jack" wrote in message
I want to add something to PATH. Where do I find it? Probably Properties
of something.
Control Panel, System & Security, System, Advanced System Settings,
Enviroment Vars, Path, Edit.
 
J

Johannes A Van KootenIN THE UK SINCE LATE 80s

"Jack" wrote in message
I want to add something to PATH. Where do I find it? Probably Properties
of something.
Control Panel, System & Security, System, Advanced System Settings,
Enviroment Vars, Path, Edit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top