【发布时间】:2012-09-03 18:38:06
【问题描述】:
我想在 Powershell 中对一个 .exe 执行 Try Catch,我的结果如下所示:
Try
{
$output = C:\psftp.exe ftp.blah.com 2>&1
}
Catch
{
echo "ERROR: "
echo $output
return
}
echo "DONE: "
echo $output
当我使用无效域时,它会返回类似 psftp.exe : Fatal: Network error: Connection refused 的错误,但我的代码没有捕捉到。
如何发现错误?
【问题讨论】:
标签: powershell try-catch