Environment variables, it’s one of those things you not often have to touch, but lately it seems i’ve had to make some manual changes all too often. So here comes the code tip for today!
The following code looks at the PATH variable but can access any of the environment variables the system holds.
Set WshShell = CreateObject("WScript.Shell")
Set WshSystemEnv = WshShell.Environment("SYSTEM")
WshSystemEnv("PATH") = WshSystemEnv("PATH") & ";C:\Program Files\Mozilla Firefox"
Note: Environment variables must be seperated with a ;
The above code gets the current set string for the environment variable PATH and then adds to it.
Of course you could use this method for other things too, for example finding out if a variable has already been set etc.
Similar Posts
- WoW Addon Tutorial: Basics Of Lua (Re-visited)
- WoW Addon Tutorial: The Basics – File Structure
- Firefox 3! and about time too!
- WoW Addon Tutorial: The Basics – The .lua File
- WoW Addon Tutorial: Creating Frames With LUA


