c# - 运行“bcdedit /?” 命令行帮助
问题描述
我已经bcdedit /set current safeboot network
从一个 C# 应用程序中执行了命令,这在我在终端中遇到的错误中:
指定的元素数据类型无法识别,或不适用于指定的条目。运行“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();
解决方案
问题是我错过了“当前”这个词周围的括号:
startInfo.Arguments = @"/C bcdedit /set {current} safeboot network & ping 8.8.8.8 -t";
推荐阅读
- regex - Perl 正则表达式字符串替换无法识别字符串中的下划线
- arrays - 空手道数组字段从 JS 函数返回时成为对象
- c# - 我怎样才能更好地为生成的六边形编写这个程序 UV 映射?
- javascript - 如何在 vue .js 上创建具有相同值的复选框
- typescript - 使用 Jest 测试 Vuejs 和 TypeScript 会导致错误“Property 'xxx' does not exist on type 'CombinedVueInstance'
- android - 安装区发现一些冲突,rt.jar修改
- docusignapi - 通过此端点的不完整总信封 /search_folders/completed?start_position=0
- html - 在文本结束处断开列表行 CSS
- sql-server - 具有 CASCADE 约束和删除过程的表?
- javascript - 如何在 facebook 即时游戏中查看 App 退出?