假设我有这个简单的PowerShell功能:
function testit() {
return $true > $null
}
Write-Host "testing"
$thistest = testit
Write-Host "value = $thistest"
Run Code Online (Sandbox Code Playgroud)
当我在PowerShell脚本中使用它时,我希望在脚本中接收值,但我不希望它在控制台中显示.
如何将返回值保留在管道中但只是将其隐藏在控制台中?
如果我使用它> $null然后它完全抑制输出 - 我只是希望它不显示在控制台中,但我仍然想要值.