To jest try catch
w PowerShell 2.0
$urls = "http://www.google.com", "http://none.greenjump.nl", "http://www.nu.nl"
$wc = New-Object System.Net.WebClient
foreach($url in $urls)
{
try
{
$url
$result=$wc.DownloadString($url)
}
catch [System.Net.WebException]
{
[void]$fails.Add("url webfailed $url")
}
}
ale to, co chcę zrobić, to coś w stylu c #
catch( WebException ex)
{
Log(ex.ToString());
}
czy to możliwe?
powershell
try-catch
Medo
źródło
źródło