John's Bread Crumbs
Thursday, August 18, 2016
PowerShell - Error Control
$numerator = 3
$denominator = 0
try
{
$myVar = $numerator / $denominator
}
catch
{
Write-Host "Something went wrong:"
Write-Host $error[0]
}
finally
{
Write-Host "Do this regardless"
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.