How can I get powershell exception descriptions into a string?

后端 未结 5 1530
猫巷女王i
猫巷女王i 2021-01-04 09:15

I want to have access to the same message that Powershell prints when you send an error record to the output stream

Example:

This is the excep

5条回答
  •  既然无缘
    2021-01-04 09:47

    Similar to @tomasr, but shorter:

    $($error[0])
    

    For all errors in a script:

    $($error)
    

提交回复
热议问题