Rab*_*abi 5 c# macos .net-core
我正在创建一个 .NET Core 控制台应用程序来运行命令。
public bool RunCommand()
{
try
{
var procStartInfo = new ProcessStartInfo("exec", "cal")
{
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = false
};
var proc = new Process { StartInfo = procStartInfo };
proc.Start();
// Get the output into a string
output = proc.StandardOutput.ReadToEnd();
return proc.ExitCode == decimal.Zero ? true : false;
}
finally
{
// do something
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误 -
Unhandled Exception: System.ComponentModel.Win32Exception: No such file or directory
at System.Diagnostics.Process.ResolvePath(String filename)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at HockeyApp.Enablers.IosCodeSign.ProcessManager.RunCommand(String command, String& output)
at HockeyApp.Enablers.IosCodeSign.Program.Main(String[] args)
Run Code Online (Sandbox Code Playgroud)
我什至尝试过 -
var procStartInfo = new ProcessStartInfo("cal")
Run Code Online (Sandbox Code Playgroud)
没有运气。
我缺少什么吗?
| 归档时间: |
|
| 查看次数: |
4346 次 |
| 最近记录: |