Suppress console output in PowerShell

前端 未结 3 1214
悲哀的现实
悲哀的现实 2020-12-09 01:04

I have a call to GPG in the following way in a PowerShell script:

$key = & \'gpg\' --decrypt \"secret.gpg\" --quiet --no-verbose > $null
3条回答
  •  情话喂你
    2020-12-09 02:06

    Try redirecting the output like this:

    $key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose >$null 2>&1
    

提交回复
热议问题