gpt4 book ai didi

c# - 如何使用 C# 验证 PowerShell 脚本是否正在运行

转载 作者:太空宇宙 更新时间:2023-11-03 15:14:19 25 4
gpt4 key购买 nike

我已经使用 C# 异步启动了一个 PowerShell 脚本。在某个时间点,我想验证脚本是否仍在使用 C# 运行。请建议我如何验证脚本是否正在运行我尝试使用 Process.GetProcessesByName("scriptname") 似乎不起作用。

最佳答案

您可能正在使用 Pipeline.InvokeAsync 方法:

After it is called, it changes the state of the pipeline to Running. When the method is completed, it changes the state of pipeline to one of following: Completed: The pipeline state is Completed if the pipeline invocation completed successfully. Failed: The pipeline state is Failed if the pipeline invocation failed or one of the commands in the pipeline threw a terminating error. Stopped: The pipeline state is Stopped if the pipeline was stopped by calling Stop or StopAsync.

Source.

关于c# - 如何使用 C# 验证 PowerShell 脚本是否正在运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39653915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com