I have a call to GPG in the following way in a PowerShell script:
$key = & \'gpg\' --decrypt \"secret.gpg\" --quiet --no-verbose > $null
It is a duplicate of this question, with an answer that contains a time measurement of the different methods.
Conclusion: Use [void]
or > $null
.
Try redirecting the output to Out-Null. Like so,
$key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose | out-null
Try redirecting the output like this:
$key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose >$null 2>&1