//css_pre com(WScript.Shell, swshell.dll); using System; using swshell; namespace Scripting { class Script { static public void Main(string[] args) { object envType = "SYSTEM"; IWshEnvironment wshSysEnv = new WshShellClass().get_Environment(ref envType); wshSysEnv["TEST"] = "MyDirectory"; Console.WriteLine("Done..."); } } }