更新时间:2023-02-03 08:20:46
我不知道是否有本机C#方法来执行此操作,但是如果没有,您总是可以退回到使用运行空间来执行Powershell管道并使用cmdlet.
I don't know if there is a native C# method to do this, but if not you can always fall back to using a runspace to execute a powershell pipeline and just use the cmdlet.
如果将运行空间保持打开状态,则重复执行将非常快.
If you keep the runspace open, repeated executions will be pretty fast.