Why does setting an environment variable require logging out to take effect?

S

Steve Kingsland

This has been bugging me for years now, and I'm finally getting around
to asking a group of people whom should know: I change an environment
variable in Windows 2000 via System Properties | Advanced |
Environment Variables | System variables, open a DOS window and type
"set", and I don't see the change I just made. As soon as I log out
and back in, or restart, I see my change. If I go back to the
Environment Variables window, I see the change there, but in order for
any programs to pick up on the change, I need to at least log out.

This frustrates me, because I know several other people who use Win2K
who DON'T have to log out for it to take effect. I think I'm now on
my 3rd or 4th computer with NT or 2000 where this has been the case!

Why, WHY, WHYYYY is this happening to me, and can anyone explain or
offer a shortcut to avoid logging out and back in? (I frequently have
lots of windows open, servers running, etc. that I don't want to close
& re-open) I recall deleting the ComSpec env. variable in NT was a
short cut for restarting... does that still work in 2000?

Thanks in advance for your help.

Steve
 
P

Pegasus \(MVP\)

If you want your new/modified environmental variable to be
immediately visible to all new processes then you have to
use setx.exe from the Win2000 Resource Kit.
 
G

Gary Smith

Steve Kingsland said:
This has been bugging me for years now, and I'm finally getting around
to asking a group of people whom should know: I change an environment
variable in Windows 2000 via System Properties | Advanced |
Environment Variables | System variables, open a DOS window and type
"set", and I don't see the change I just made. As soon as I log out
and back in, or restart, I see my change. If I go back to the
Environment Variables window, I see the change there, but in order for
any programs to pick up on the change, I need to at least log out.

How are you opening the command Window?
 
S

Steve Kingsland

Gary Smith said:
How are you opening the command Window?

Well, that's interesting that you ask... I've been using the shortcut
in the MS Office shortcut bar to launch the DOS window. When I tried
Start | Run | cmd.exe, and typed "set", then I saw the change!!! The
shortcut is executing %SystemRoot%\system32\cmd.exe , which resolves
to c:\winnt\system32\cmd.exe, which is what I get when I type cmd.exe
in the Run dialog! Can anyone explain this?

As for setx.exe, I'll give that a shot. (never used it before, but
heard it mentioned on here)

Thanks,
Steve
 
G

Gary Smith

Well, that's interesting that you ask... I've been using the shortcut
in the MS Office shortcut bar to launch the DOS window. When I tried
Start | Run | cmd.exe, and typed "set", then I saw the change!!! The
shortcut is executing %SystemRoot%\system32\cmd.exe , which resolves
to c:\winnt\system32\cmd.exe, which is what I get when I type cmd.exe
in the Run dialog! Can anyone explain this?

Yep, I had the same problem. It seems that programs invoked from the
Office shortcut bar execute as child processes of OSA9.EXE (could be OSA8
or OSA10, depending on the office version) and get a copy of the
environment that was in effect when it started. Thus they don't see any
changes. Most of the time this isn't a problem, but it's a big thing when
you're running a command prompt. What I did was to remove the shortcut
from the Office bar and put one on the Quick Launch bar instead.
 
S

Steve Kingsland

Gary Smith said:
Yep, I had the same problem. It seems that programs invoked from the
Office shortcut bar execute as child processes of OSA9.EXE (could be OSA8
or OSA10, depending on the office version) and get a copy of the
environment that was in effect when it started. Thus they don't see any
changes. Most of the time this isn't a problem, but it's a big thing when
you're running a command prompt. What I did was to remove the shortcut
from the Office bar and put one on the Quick Launch bar instead.

Wow, that completely makes sense! I've been using the office shortcut
bar for a few years now, and most other people don't use it. That
explains why this has been a persistent problem for me, but not for
most other people.

Are their any other issues with starting progrems from the office
shortcut bar that you know of? Especially Java-based programs, such
as Lotus Notes client, Weblogic, IntelliJ, DbVisualizer, etc.; and
windows stuff such as IE, Word, Media Player, ...

Thanks a lot for shedding light on this!

Steve
 
G

Gary Smith

Wow, that completely makes sense! I've been using the office shortcut
bar for a few years now, and most other people don't use it. That
explains why this has been a persistent problem for me, but not for
most other people.
Are their any other issues with starting progrems from the office
shortcut bar that you know of? Especially Java-based programs, such
as Lotus Notes client, Weblogic, IntelliJ, DbVisualizer, etc.; and
windows stuff such as IE, Word, Media Player, ...

I haven't seen any other problems at all. I started using the shortcut
bar in Office 97, when there was a problem with programs which added an
entry to the context menu for all files. That problem was repaired in
Office 2000. I don't use much Java-based stuff, but I invariably start
Word, Excel. IE, Windows Explorer and a number of other programs from the
shortcut bar, and I've never had a hint of trouble.
 

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