random8011 0 Report post Posted August 5, 2004 (edited) PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem I want to make the path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\oracle how can i do? my script: $oldpath = EnvGet("PATH") $newpath = "$oldpath"&";c:\oracle" EnvSet("PATH", $newpath) EnvUpdate() it seems no use help me ,thanks Edited August 5, 2004 by random8011 Share this post Link to post Share on other sites
random8011 0 Report post Posted August 5, 2004 else .. EnvSet("Path", "this is a test") Why It seems take no effect??? how can i change my system's Evn Path??? Share this post Link to post Share on other sites
ezzetabi 2 Report post Posted August 5, 2004 Do you read the Bold part? Or really you have no effect?A environment variable set in this way will only be accessible to programs that AutoIt spawns (Run, RunWait). Once AutoIt closes, the variables will cease to exist. Share this post Link to post Share on other sites
ezzetabi 2 Report post Posted August 5, 2004 SETX is the most easy solution. Share this post Link to post Share on other sites
random8011 0 Report post Posted August 6, 2004 SETX is the most easy solution. <{POST_SNAPBACK}>i have just seen the problem about setx,what should i do?i really don't know,,plz give me a little tips,thanks Share this post Link to post Share on other sites
commenti 0 Report post Posted August 6, 2004 Hello random8011, if your problem is what ezzetabi wrote in the bold part (" Once AutoIt closes, the variables will cease to exist.") and you don´t want to use setx, just AutoIt, you can try this small function I wrote a while ago for my loginscripts: Func setuserenv ($nameandvalue) $name=stringmid($nameandvalue,1,StringInStr ( $nameandvalue, "=",1)-1) $value=stringmid($nameandvalue,StringInStr ( $nameandvalue, "=",1)+1,256) RegWrite("HKEY_CURRENT_USER\Environment", $name, "REG_EXPAND_SZ", $value) EnvUpdate ( ) EndFunc Usage is like that (example): setuserenv ("PATH=C:\TEST") Note the function only sets enviroment for the current user. (Should be fine most of the time + in this case you don´t need adminrights to use the function). I only tested it on german WinXP and Win2000 systems but I don´t see any reason why it should not work on other language system, too. So you might give it a try if you like. commenti Share this post Link to post Share on other sites
random8011 0 Report post Posted August 6, 2004 to commenti , it's so kind of u. your code make me know the very interesting "Func" function in autoit. i will try it ,thanks a lot. Share this post Link to post Share on other sites
ezzetabi 2 Report post Posted August 6, 2004 SetX is a command line utility for modifing Environment values.It is quite handy if you want avoid messing with the registry.http://www.microsoft.com/windows2000/techi...ting/setx-o.aspMS included a installer. it is completly unnecessary. Setx.exe is the important file. Share this post Link to post Share on other sites