为什么信息可以重定向,但 DeBug/Verbose 不能?(默认情况下,它们不会显示在主机上)



下面的pester测试代码很好地说明了这个问题。

PowerShell.exe -nologo -noProfile -Command 'Write-information "information"' | Should -BeNullOrEmpty
PowerShell.exe -nologo -noProfile -Command 'Write-DeBug "DeBug"' | Should -BeNullOrEmpty

(Write-information "information" *>&1) | Should -BeOfType 'System.Management.Automation.InformationRecord'
(Write-DeBug "DeBug" *>&1) | Should -BeNullOrEmpty

write-DeBug/write-Verbose相比,write-information的行为一致性较差的原因是什么?

在看了帮助文件后,我没有找到答案,所以我来这里寻求帮助。

Powershell帮助-about_redirection

相关内容

最新更新