运行 powershell 命令作为后台

问题描述

我需要触发 TFS 构建运行命令作为后台进程。我怎样才能在 Powershell 中做到这一点?我曾尝试使用 Start-Job 命令,但它不起作用。需要你的帮助。

C:\Program Files (x86)\Microsoft Visual Stu@R_404_6230@\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TFSBuild.exe start  /collection:"https://test.tfs.siemens.net/test" /builddeFinition:"Test\Test.build"

解决方法

使用 start-process 命令启动脚本。这将确保在任务完成时启动的作业继续运行。但是当构建完成时作业将被关闭。

Start-Process powershell.exe -ArgumentList '-file xxxx.ps1'