如何在点源ps1时捕获一个execption

时间:2016-02-05 11:15:19

标签: powershell import try-catch

Try
{
    . \\isrv\functions\Functions.ps1
}
Catch
{
    #Write-Logging -level Error "IMPORT : Failed doing an import of   functions.ps1
}

\\isrv does not exist , but still its not going into the catch.

当我在try / catch之外尝试. \\isrv\functions\Functions.ps1时我得到错误:路径或文件不知道所以我可以用它来构建我的捕获..但是在try中捕获它不起作用?

0 个答案:

没有答案