0

I'm using Start-Process cmdlet as part of a Powershell script being executed by the new scriptable TFS build system.

My issue is that I'm starting some executables from my Powershell script and once the build step ends, it kills started processes.

I've also also tried to use ProcessStartInfo directly and Start-Job with no luck.

When I run that script alone it ends, but it leaves the started processes opened.

Is there any way to solve this?

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206

1 Answers1

0

You can use start-Job:

Start-Job -ScriptBlock { start C:\Windows\notepad.exe }

After exiting the PS, Notepad is still open

Check this post for more info:

if you start a script using Start-Process, it will survive the shell termination, but if you started it from a console window then it stays bound to that window and closing the window will terminate the process

Community
  • 1
  • 1
Martin
  • 1,853
  • 3
  • 15
  • 22