Sat*_*eus -1 c# console command-line
我试图在我的 C# 代码中使用此命令“winsatformal”运行隐藏控制台,但它在“Process.Start()”中给出错误。这是我的代码:
string command = "winsat formal";
Process process = new Process();
process.StartInfo.FileName = command;
process.Start();
Run Code Online (Sandbox Code Playgroud)
您需要按如下方式传递参数。
Process process = new Process();
process.StartInfo.FileName = "winsat" ;
//in here you add as many parameters as needed
process.StartInfo.Arguments = "formal" ;
process.Start();
Run Code Online (Sandbox Code Playgroud)
更新 1
如果您转到“cmd”命令行并输入“winsatformal”,它会起作用吗?如果不是,您需要执行以下操作之一
process.StartInfo.WorkingDirectory = "c:\your\path\toWinSat\executable\" ;
如果它仍然不起作用,请告诉我
更新 2
//您是否尝试过证明可执行文件的完整路径?
process.StartInfo.FileName = "C:\windows\system32\winsat.exe"
Run Code Online (Sandbox Code Playgroud)