我需要在C#程序中运行一个命令“control bthprops.cpl”。该命令会打开蓝牙设置控制面板窗口。我尝试使用Process.Start()运行它,但蓝牙窗口不显示。我也尝试将BAT文件写入磁盘并通过我的程序执行,但仍然存在相同的问题。有什么办法可以做到这一点?如何运行“运行栏”命令?
//Dump BAT File and execute it
string path = System.IO.Directory.GetCurrentDirectory()+"startBT.bat";
string[] content = {"control bthprops.cpl"};
System.IO.File.WriteAllLines(path, content);
//Execute BAT file
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = path;
p.Start();
向我们展示你的Process.Start() – DogGuts
更新使用精确的微码!谢谢。 – AccurateEstimate