random8011 Posted August 5, 2004 Share 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 Link to comment Share on other sites More sharing options...
random8011 Posted August 5, 2004 Author Share 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??? Link to comment Share on other sites More sharing options...
ezzetabi Posted August 5, 2004 Share 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. Link to comment Share on other sites More sharing options...
ezzetabi Posted August 5, 2004 Share Posted August 5, 2004 SETX is the most easy solution. Link to comment Share on other sites More sharing options...
random8011 Posted August 6, 2004 Author Share 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 Link to comment Share on other sites More sharing options...
commenti Posted August 6, 2004 Share 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 Link to comment Share on other sites More sharing options...
random8011 Posted August 6, 2004 Author Share 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. Link to comment Share on other sites More sharing options...
ezzetabi Posted August 6, 2004 Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now