Powershell帮助-about_redirection
下面的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
的行为一致性较差的原因是什么?
在看了帮助文件后,我没有找到答案,所以我来这里寻求帮助。