RebolTutorial Posted July 25, 2010 Share Posted July 25, 2010 I can use rebol to get the value of path environment variable but I cannot modify it so I'd like to use autoit to do so. Is it possible ? If yes can you give me a sample code or a clue ? thanks. Rebol Tutorial: Join the Rebolution! Link to comment Share on other sites More sharing options...
sahsanu Posted July 25, 2010 Share Posted July 25, 2010 (edited) I can use rebol to get the value of path environment variable but I cannot modify it so I'd like to use autoit to do so. Is it possible ? If yes can you give me a sample code or a clue ? thanks. Yes, it is possible . Take a look to help file; EnvGet, EnvSet & EnvUpdate. Edit: Well, using EnvSet to set an environment variable will made this "add" available to programs that AutoIt spawns (Run, RunWait). Once AutoIt closes, the variables will cease to exist. So, if you want to make the change permanent could use something like this: $key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" $val = "PATH" $PATH = RegRead($key, $val) $sAddThisPath = "C:\my new path\" $PATH = $PATH & ";" & $sAddThisPath RegWrite($key,$val,"REG_EXPAND_SZ",$PATH) EnvUpdate() Cheers, sahsanu Edited July 25, 2010 by sahsanu ctyankeeinok 1 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