简体   繁体   中英

Can Start-Process start a process and let it run even when script ends in TFS?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM