tags:

views:

225

answers:

1

I have a custom PowerShell runspace from which I execute a script (simplified):

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

In the script I do:

# c:\temp\MyScript.ps1
notepad.exe

Now the Invoke() returns when notepad is closed.

Is there a way to start an app, keep the app running but finishing the script code?

+5  A: 

In the script you can do

[Diagnostics.Process]::Start("notepad.exe")
Jay Bazuzi
Thanks! That solved the problem!
Serge van den Oever