This is correct and by design. When you use AdminMisc::SetEnvVar() it sets the env var then sends out a system wide message indicating the environment has been updated. Any service and application that listens for this message can then update its copy of the environment (basically "refreshing" and getting the modified variable). However neither Perl nor the cmd.exe application listens for this message. Therefore all perl and cmd.exe processes will not be updated with the modified variable. You would have to either quite the console app and rerun it, at which time it gets a fresh copy of the environment (with the modified variables). If a perl process is running and you quit it, you still have to quit the cmd.exe process before rerunning the Perl script. This is because Perl will be given a copy of its parent process's (the cmd.exe process) environment.
dave -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 12:29 PM To: 'Dean Theophilou'; Beginners-Cgi@Perl. Org; Perl-Win32-Admin@ActiveState. com Subject: RE: AdminMisc::SetEnvVar I have been using this function without a problem for a few months on my users... Is it really not changing the Environment variable, or is it not changing it for a console window that you have open? What I mean is that I have noticed that if I have a console window open when I use Win32::AdminMisc::SetEnvVar(), I have to set the environment variable for the window separately, but all other non-console windows use the new environment. I set it by setting the appropriate key in the %ENV hash. For example, "$ENV{'TIA'} = 865"; -----Original Message----- From: Dean Theophilou [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 12:13 PM To: Beginners-Cgi@Perl. Org; Perl-Win32-Admin@ActiveState. com Subject: AdminMisc::SetEnvVar Hello: I wrote a script that modifies an environment variable during logon with the Wi32::AdminMisc::SetEnvVar function. Although the function sets the environment variable as expected, the change does not take effect until one of two things happen: 1) The user logs off and then back on; 2) The user goes to the System applet->Environment tab and then clicks "Ok" (note that I don't have to do anything in the Environment tab; I only have to click on "OK"). So, my question is: why is this happening? Did I do something wrong. Am I using the wrong function. Is there some way to emulate the clicking of the "Ok" button in the Environment tab? Thank you. Dean Theophilou Genisar _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin ---------------------------------------------------------------------------- ---- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]