#79466 - 2003-01-31 05:42 PM
4.12 & 4.20 SETM bug
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
|
Since 4.12, SETM updates the USER environment instead of the SYSTEM environment.
Test code: code:
? "@KIX" set "TEST1=one" setl "TEST2=two" setm "TEST3=three" shell "cmd /c set > kix.log"
Running this with 4.01, I have TEST1 in the USER environment, TEST2 defined in the running kix environment (as evidenced by the contents of the kix.log file), and TEST3 in the GLOBAL/SYSTEM environment.
Running this with 4.12 or 4.20rc2 results in both TEST1 and TEST3 being defined in the USER environment.
This is confirmed by looking at the My Computer/Properties/Advanced/Environment utility as well as examining the registry keys.
I've run the above simple test on 2K Pro, 2K Server, and XP Pro.
I have adapted my script to directly write the values to the registry, but the user must log off & on for them to take effect. The SETM command uses a notification function to alert applications that the environment definition has changed - something that direct registry updates won't do. My workaround uses SETM to unset a fake value so the notification occurs.
code:
Function fSETM( $EDEF ) SETM("_My_JuNk_=T") ; define fake varname $ENVKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" $aryENVARGS = Split($EDEF, "=", 2) $fnSETM = WriteValue($ENVKEY, $aryENVARGS[0], $aryENVARGS[1], "REG_EXPAND_SZ") SETM("_My_JuNk_=") ; remove fake varname, result is a notification to reread the env EndFunction
fsetm("TEST4=four")
This now properly sets a system environment.
Glenn [ 31. January 2003, 17:59: Message edited by: Glenn Barnas ]
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
#79473 - 2003-02-03 09:43 AM
Re: 4.12 & 4.20 SETM bug
|
Anonymous
Anonymous
Unregistered
|
Thanks for the report.
This is indeed a regression, and it will be fixed in the final build of 4.20.
Kind regards,
Ruud
|
|
Top
|
|
|
|
Moderator: ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
0 registered
and 857 anonymous users online.
|
|
|