How to suppress all the uninvited output? I recently started coding on PS and this obsessive ubiquitous output everywhere drives me crazy. I have to spam | Out-Null
, [void]
all around the codebase keeping an eye on every call because otherwise, the function will return a corrupted value with a bunch of parasite neighbors. Like a developer mainly on traditional languages, I don't understand the pleasure of seeing in the terminal a whole bunch of bullshit like 0
, 7582645
, ============
etc. Ideally, I want that output will fires only when I explicitly ask it for - echo/print/Write-Host and nothing more. I've tried some workarounds but with no luck. A tiny synthetic example:
function out-default
{
$input | out-null
}
$PSDefaultParameterValues = @{
'New-Item:OutVariable' = 'Null'
'Disabled' = $False
}
function get
{
"1"
[Text.Encoding]::ASCII.GetBytes( "test" )
return "value"
}
get
<#
the output actual: 1 116 101 115 116 value
the output wanted: value
#>
Anybody save me, please :(