从自定义运行空间中执行的PowerShell启动应用程序,让应用程序保持运行,完成脚本?

Ser*_*ver 3 powershell

我有一个自定义PowerShell运行空间,我从中执行脚本(简化):

Pipeline pipeline = myRunSpace.CreatePipeline(@"c:\temp\Myscript.ps1");
Collection<PSObject> results = pipeLine.Invoke();
Run Code Online (Sandbox Code Playgroud)

在脚本中我做:

# c:\temp\MyScript.ps1
notepad.exe
Run Code Online (Sandbox Code Playgroud)

现在Invoke()关闭记事本时的回报.

有没有办法启动应用程序,保持应用程序运行,但完成脚本代码?

Jay*_*uzi 6

在脚本中你可以做到

[Diagnostics.Process]::Start("notepad.exe")
Run Code Online (Sandbox Code Playgroud)