1.

Solve : System varibles?

Answer»
Hello
I WANT to WRITE a script for windows to edit the SYSTEM variables. Does anyone knowed how can I get to the Windows system variable??
Tnks

DavidThis might help. Note: MYVAR is just arbitrary name I made up.

Dim WshShell, WshEnv
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshEnv = WshShell.Environment("SYSTEM")

To set the MYVAR variable use:

WshEnv("MYVAR") = "Any Value"

To remove the MYVAR variable use:

WshEnv.Remove "MYVAR"

If you use the SET command from the command line, you will get a list of all variables defined in the environment. If you need new ONES, just make one up and change MYVAR accordingly. Any changes/additions made, only last as long as the user session.


Hope this helps.


Discussion

No Comment Found