支持所有版本。 当你运行控制台EXE命令,如robocopy.exe, ipconfig.exe或类似命令。你可以用Powershell获得他们引起的错误: 代码如下: try { $current = $ErrorActionPreference $ErrorActionPreference = ‘Stop’ # this will cause an EXE command to emit an error # (replace with any console-based EXE command) net.exe user nonexistentU