我一直在使用以下代码通过单击按钮直接打开环境变量屏幕:
private void OpenEnvVariables()
{
Process p = new Process();
p.StartInfo.WorkingDirectory = @"C:\Windows\System32";
p.StartInfo.FileName = "rundll32.exe";
p.StartInfo.Arguments = "sysdm.cpl,EditEnvironmentVariables";
p.StartInfo.Verb = "runas";
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.Start();
}
在我在 Windows 10 上运行我的工具应用程序之前,它一直运行良好。现在它什么也没做。 Run仍然可以处理sysdm.cpl但似乎我无法正确传递参数。
任何帮助,将不胜感激。