public void Regedit()
{
try
{
string path = Environment.GetEnvironmentVariable("path");
string new_path = path + ";" + @"C:\TEST\cmd\";
Environment.SetEnvironmentVariable("path", new_path, EnvironmentVariableTarget.Machine);
}
catch (Exception ex)
{
MessageBox.Show("小主添加环境变量报错了,原因:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论