O'Reilly logo

Learn PowerShell Toolmaking in a Month of Lunches by Don Jones and Jeffrey Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.5. Dealing with logic errors: breakpoints

Technically, Write-Debug acts as a sort of permanent, manually inserted breakpoint in your script. When the shell hits Write-Debug, it pauses your script and lets you investigate things. PowerShell also supports a more dynamic form of breakpoint, called a PSBreakpoint.

You create a PSBreakpoint by running Set-PSBreakpoint. Using parameters of that command, you tell PowerShell what script the breakpoint goes with (it’s based on the path and filename, so the breakpoint will only work so long as the script stays in the same spot) and what you want the breakpoint to trigger on. Your choices include the following:

  • Stopping on a particular line or line/character position, which is similar to sticking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required