后台进程中的开始成绩单 [英] Start-transcript in a background process

查看:74
本文介绍了后台进程中的开始成绩单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以在后台进程中处理开始记录?我有一个在后台启动的脚本.除了使用开始记录进行日志记录外,几乎所有功能都可以正常运行?实际上,它创建了我的$ filelog.txt但没有在其中写入任何内容?

is there a way to handle start-transcript in a background process? I have a script launched in background. almost everything works fine, except logging with start-transcript? in fact, it creates my $filelog.txt but doesn't write anything in it?

推荐答案

您无法做到,非交互式PowerShell主机(在您的情况下为后台作业)不支持主机输出Cmdlet,例如Start-Transcript,Write-Host等例如,您将必须使用自己的日志记录功能或通过Out-File将消息输出到文件.

You cannot do it, non-interactive PowerShell hosts (in your case background job) don't support host output Cmdlets like Start-Transcript, Write-Host etc. You'd have to use you own logging functions or output messages to file via Out-File for example.

这篇关于后台进程中的开始成绩单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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