Start-Job 输出去哪里了? [英] Where does Start-Job output go?

查看:75
本文介绍了Start-Job 输出去哪里了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

W:> $job = start-job { Write-Output "hi there"; throw "an error!" } | Wait-Job
W:> $job | select *


State         : Failed
HasMoreData   : True
StatusMessage :
Location      : localhost
Command       :  Write-Output "hi there"; throw "an error!"
JobStateInfo  : Failed
Finished      : System.Threading.ManualResetEvent
InstanceId    : 882957a9-a5e0-4876-bd22-0dbd87512f10
Id            : 7
Name          : Job7
ChildJobs     : {Job8}
PSBeginTime   : 3/24/2013 5:52:41 PM
PSEndTime     : 3/24/2013 5:52:47 PM
PSJobTypeName : BackgroundJob
Output        : {}
Error         : {}
Progress      : {}
Verbose       : {}
Debug         : {}
Warning       : {}

我的输出去哪儿了?我如何查看标准输出/错误流?

Where did my output go? How do I see the standard out/error streams?

推荐答案

作业在后台运行,因此它们不会写入控制台.您必须在作业完成后运行 Receive-Job 以收集它的输出.

Jobs are running in the background, so they don't write to the console. You have to run Receive-Job after a job completes to collect its output.

这篇关于Start-Job 输出去哪里了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆