powershelldebugging

does powershell have a hard breakpoint keyword


Been searching around and not able to find an answer to whether or not powershell has a hard breakpoint solution. Something like javascript debugger; and python breakpoint() and vb Stop.

Instead i have to author dummy lines inside if statements that i can assign soft breakpoints to.

if ($item.Value -eq "some large iteration case i need to debug through") { 
    $i = "using to enable soft breakpoint on specific case for debugging purposes as powershell doesn't appear to have have hard breakpoint expression"
}


Solution

  • You can use Set-PSBreakpoint and enable/disable-psbreakpoint

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-psbreakpoint?view=powershell-7

    https://ss64.com/ps/enable-psbreakpoint.html