运行“ bcdedit /?”用于命令行帮助

时间:2019-05-13 10:53:56

标签: c# cmd .net-core

我已经从一个C#应用程序中执行了命令bcdedit /set current safeboot network,这是我在终端中遇到的错误:

指定的元素数据类型无法识别,或者不适用于 指定的条目。 运行“ bcdedit /?”用于命令行帮助。 找不到元素。


这是我的代码:

System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = "cmd.exe";
startInfo.UseShellExecute = true;
startInfo.Verb = "runas";
startInfo.Arguments = @"/C  bcdedit /set current safeboot network & ping 8.8.8.8 -t";
//startInfo.Arguments = "/C ping 8.8.8.8 -t";
process.StartInfo = startInfo;
process.Start();

1 个答案:

答案 0 :(得分:2)

问题是我缺少“当前”一词的括号:

startInfo.Arguments = @"/C  bcdedit /set {current} safeboot network & ping 8.8.8.8 -t";
相关问题