Start-Job - retrieve output in real time

喜你入骨 提交于 2020-01-24 13:52:07

问题


We start a Powershell function via Start-Job and want to retrieve its output in the caller in real time. Is there a nice way to do so without calling Retrieve-Job in a loop?


回答1:


Try something like this:

$appJob = Start-Job { foreach($i in 1..10) { Write-Output "Testing $i"; Start-Sleep 10 } }
$appJob.ChildJobs[0].Output


来源:https://stackoverflow.com/questions/48909983/start-job-retrieve-output-in-real-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!