【发布时间】:2020-06-11 14:31:13
【问题描述】:
我正在尝试使用here 概述的框架从 .NET Core 应用程序中运行一组 PowerShell 脚本。基本代码如下:
using (var ps = Powershell.Create()) {
ps.AddScript(script);
var output = new PSDataCollection<PSObject>();
await ps.InvokeAsync<PSObject, PSObject>(null, output);
}
我的问题是,如何检索脚本的退出代码?
【问题讨论】:
-
AFAIK 你只能尝试捕捉
标签: c# .net-core powershell-core