How to capture error messages thrown by a command?

后端 未结 3 647
南笙
南笙 2020-12-29 12:47

I am writing a PowerShell script where in I need to capture the error message that it\'s throwing. Note: according to PowerShell, there is no error and command is executed s

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-29 13:16

    Assuming your executable is named svn.exe and is on the path, you can capture the messages it sends to console this way:

    $msg = [string] (svn.exe )
    

    You can then parse the $msg string to find information you need.

提交回复
热议问题