DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Error Handling — Example 114

Quick explanation + ready code for: Error Handling.

PowerShell Error Handling Back to examples
Back to language
Syntax: Error Handling in PowerShell. ID: #114

Code

try{ throw "bad" }catch{ Write-Host $_ }

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.