首页 > 解决方案 > 为什么信息可以重定向但调试/详细不能?(默认情况下它们不会显示在主机上)

问题描述

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

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-information相比,行为一致性差的原因是什么?write-DeBugwrite-Verbose

看了帮助文档,没有找到答案,所以特地来这里求助。

标签: powershell

解决方案



推荐阅读