Is it possible to check if -Verbose argument was given in Powershell?

前端 未结 5 1101
温柔的废话
温柔的废话 2021-02-07 02:35

I have written my own Powershell logging function Log with parameters stream (on which stream to write the message) and message (the messa

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-07 02:38

    Inside your script check this:

    $PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent
    

提交回复
热议问题