如何用代码添加环境变量?
如何用代码添加环境变量?[此贴子已经被作者于2006-7-18 11:10:17编辑过]
[此贴子已经被作者于2006-7-18 11:10:17编辑过]
添加系统环境变量需要修改注册表
using Microsoft.Win32;
RegistryKey key = Registry.LocalMachine.CreateSubKey(@"System\CurrentControlSet\Control\Session Manager\Environment");
key.SetValue("YTName", "YTValue");