clh
2007-09-10 21:54:09 UTC
I'm using the below code in a .vbs to creat a "Volatile" environment
variable. The whole reason I'm doing this is that I DON'T want the value of
this variable to persist when the user logs out or reboots the computer. The
variable is set correctly, and if the computer is completely restarted then
the variable does not persist, but if the user only does a "log off" and then
logs back in, this "Volatile" environment variable is still there.
Everything I've been able to find (which is just a few pieces here and
there) on volatile environment variables says they are NOT supposed to
persist through a log off. So why are they? Or is that by design and the
few things I've found that say that are wrong?
Oh, this is on Windows XP Professional SP2 with all patches up to date.
Thank you.
******************************************
Dim WSHShell
Dim objEnv
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objEnv = WSHShell.Environment("Volatile")
objEnv("TestVar") = "Test Value"
Set objEnv = Nothing
Set WSHShell = Nothing
******************************************
variable. The whole reason I'm doing this is that I DON'T want the value of
this variable to persist when the user logs out or reboots the computer. The
variable is set correctly, and if the computer is completely restarted then
the variable does not persist, but if the user only does a "log off" and then
logs back in, this "Volatile" environment variable is still there.
Everything I've been able to find (which is just a few pieces here and
there) on volatile environment variables says they are NOT supposed to
persist through a log off. So why are they? Or is that by design and the
few things I've found that say that are wrong?
Oh, this is on Windows XP Professional SP2 with all patches up to date.
Thank you.
******************************************
Dim WSHShell
Dim objEnv
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objEnv = WSHShell.Environment("Volatile")
objEnv("TestVar") = "Test Value"
Set objEnv = Nothing
Set WSHShell = Nothing
******************************************