使用powershell和我有几个项目,我正在触发使用开始作业。现在我想显示作业的一些状态,但问题是,如果有许多作业要处理,那么自动生成的名称Job1-x就不是很有帮助了。
如何向作业添加自定义名称,以便在作业完成时指示状态。
Start-Job -ScriptBlock { tfsbuild start /collection:"xxx" /builddefinition:"xxx1" }
Start-Job -ScriptBlock { tfsbuild start /collection:"xxx" /builddefinition:"xxx2" }
Do
{
$meJobStatesRunning = Get-Job -State Running
Start-Sleep -s 1 #give time for job to process before checking.
} While ($meJobStatesRunning -notlike '')
Get-Job | foreach { if ($_.state -eq "Completed") {write-host -f green $_.name $_.state } else {write-host -f red $_.name $_.state } }发布于 2015-05-22 21:32:14
是的,使用-Name参数。
Start-Job -Name MyName -ScriptBlock { tfsbuild start /collection:"xxx" /builddefinition:"xxx1" }https://stackoverflow.com/questions/30406146
复制相似问题