Suppress output from non-PowerShell commands?

前端 未结 3 1712
梦如初夏
梦如初夏 2021-02-05 02:27

I am running a command

hg st

and then checking it\'s $LASTEXITCODE to check for availability of mercurial in the current director

3条回答
  •  误落风尘
    2021-02-05 03:06

    A fun thing you can do is to pipe the output to Write-Verbose, then you can still see it if you need it by running your script with the -Verbose switch.

    ping -n 2 $APP 2>&1 | Write-Verbose
    

提交回复
热议问题