为什么Write-Host结果被发送到文件?

问题描述 投票:0回答:1

我到处都读(即Redirect Write-Host statements to fileWrite-Host无法重定向到文件。但

鉴于t.ps1文件:

function Log(){
    Write-Host "host msg"
}

Log

我在文件中看到“host msg”:

PS D:\> & ./t.ps1 *>> .\out.log

PS D:\> gc .\out.log
host msg
powershell
1个回答
0
投票

我猜你可以写输出而不是写主机,将输出重定向到文件或使用管道和文件外cmdlet。

© www.soinside.com 2019 - 2024. All rights reserved.