避免在写输出中换行 [英] Avoiding newline in write-output

查看:30
本文介绍了避免在写输出中换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将脚本的所有输出收集到一个日志文件中,并且必须使用 write-output instaed 代替 write-host.

I want to collect all output from my script in a log file and must use write-output instaed of write-host.

Write-Output "Server:" $a 看起来像

<代码>服务器:
foo.

我真的要写才能写吗
write-output $("sfdghk:" + $a) 得到 Server:Foo

Do I really have to write to write
write-output $("sfdghk:" + $a) to get Server:Foo

谢谢-jt

推荐答案

在 Internet 某处找到:

Found somewhere on the Internet:

Write-Output "Server: $($a)"

在我的代码中效果很好.

Works great in my code.

这篇关于避免在写输出中换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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