Sunday, 23 November 2008


    Demonstrates try/catch/finally in V2
    Shows a simple example of the try/catch/finally syntax
    introduced into PowerShell V2 CTP3 . The script divides by
    zero which creates an exception. The PowerShell parser
    is smart enough to recognise any attempt to divide 
    by "0" and therefore does not generate the run time error.
    File Name  : Show-TryCatchFinally.ps1
    Author     : Thomas Lee -
    Requires   : PowerShell V2

# Start of script

# Try something that fails
 'Caught in a catch block'
Finally {'All done with trying and catching'

No comments: