try { get-content "c:\GarbageFileName.txt" -ErrorAction stop } catch { write-output "in catch, I want it to stop now" break } write-output "try-catch finished, script is continuing" And a small addendum, in case it helps you: with finally , you can add some lines of code that are always executed, regardless of wether an exception was thrown or not. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.