我想澄清一件事,为什么我们Runspace
在C#
. 即使没有Runspace
.
如果它可以在没有Runspace
我们需要的情况下运行?
例如:
PowerShell ps = PowerShell.Create();
ps.AddScript("Import-Module AzureAD");
即使没有Runspace
. 为什么呢?
Runspace 提供用于创建管道、访问会话状态等的 API。
使用时PowerShell
,我们需要使用System.Management.Automation.PowerShell
,它是使用System.Management.Automation.Runspaces
。
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Management.Automation.Runspaces;
namespace System.Management.Automation
{
public sealed class PowerShell : IDisposable
{
......
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句