external help file | Locale | Module Name | ms.date | online version | schema | title |
---|---|---|---|---|---|---|
Microsoft.PowerShell.Commands.Utility.dll-Help.xml |
en-US |
Microsoft.PowerShell.Utility |
12/12/2022 |
2.0.0 |
Get-PSBreakpoint |
Gets the breakpoints that are set in the current session.
Get-PSBreakpoint [-Script <String[]>] [<CommonParameters>]
Get-PSBreakpoint [-Script <String[]>] -Variable <String[]> [<CommonParameters>]
Get-PSBreakpoint [-Script <String[]>] -Command <String[]> [<CommonParameters>]
Get-PSBreakpoint [-Script <String[]>] [-Type] <BreakpointType[]> [<CommonParameters>]
Get-PSBreakpoint [-Id] <Int32[]> [<CommonParameters>]
The Get-PSBreakPoint
cmdlet gets the breakpoints that are set in the current session. You can use
the cmdlet parameters to get particular breakpoints.
A breakpoint is a point in a command or script where execution stops temporarily so that you can
examine the instructions. Get-PSBreakpoint
is one of several cmdlets designed for debugging
PowerShell scripts and commands. For more information about the PowerShell debugger, see
about_Debuggers.
This command gets all breakpoints set on all scripts and functions in the current session.
Get-PSBreakpoint
This command gets the breakpoint with breakpoint ID 2.
Get-PSBreakpoint -Id 2
Function :
IncrementAction :
Enabled :
TrueHitCount : 0
Id : 2
Script : C:\ps-test\sample.ps1
ScriptName : C:\ps-test\sample.ps1
These commands show how to get a breakpoint by piping a breakpoint ID to Get-PSBreakpoint
.
$B = `Set-PSBreakpoint` -Script "sample.ps1" -Command "Increment"
$B.Id | Get-PSBreakpoint
The Set-PSBreakpoint
cmdlet creates a breakpoint on the Increment function in the Sample.ps1
script and saves the breakpoint object in the $B
variable. The Id property of the breakpoint
object in the $B
variable is piped to the Get-PSBreakpoint
cmdlet to display the breakpoint
information.
This command gets all of the breakpoints in the Sample.ps1
and SupportScript.ps1
files.
Get-PSBreakpoint -Script "Sample.ps1, SupportScript.ps1"
This command does not get other breakpoints that might be set in other scripts or on functions in the session.
This command gets all Command breakpoints that are set on Read-Host
or Write-Host
commands in
the Sample.ps1
file.
Get-PSBreakpoint -Command "Read-Host, Write-Host" -Script "Sample.ps1"
Get-PSBreakpoint -Type Command -Script "Sample.ps1"
This command gets all Command breakpoints in the Sample.ps1 file.
This command gets breakpoints that are set on the $Index
and $Swap
variables in the current
session.
Get-PSBreakpoint -Variable "Index, Swap"
This command gets all line and variable breakpoints in the Sample.ps1
script.
Get-PSBreakpoint -Type Line, Variable -Script "Sample.ps1"
Specifies an array of command breakpoints that are set on the specified command names. Enter the command names, such as the name of a cmdlet or function.
Type: System.String[]
Parameter Sets: Command
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the breakpoint IDs that this cmdlet gets. Enter the IDs in a comma-separated list. You can
also pipe breakpoint IDs to Get-PSBreakpoint
.
Type: System.Int32[]
Parameter Sets: Id
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies an array of scripts that contain the breakpoints. Enter the path (optional) and names of one or more script files. If you omit the path, the default location is the current directory.
Type: System.String[]
Parameter Sets: Script, Variable, Command, Type
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies an array of breakpoint types that this cmdlet gets. Enter one or more types. The acceptable values for this parameter are:
- Line
- Command
- Variable
You can also pipe breakpoint types to Get-PSBreakPoint
.
Type: Microsoft.PowerShell.Commands.BreakpointType[]
Parameter Sets: Type
Aliases:
Accepted values: Line, Variable, Command
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies an array of variable breakpoints that are set on the specified variable names. Enter the variable names without dollar signs.
Type: System.String[]
Parameter Sets: Variable
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe breakpoint IDs to this cmdlet.
You can pipe breakpoint types to this cmdlet.
This cmdlet returns objects that represent the breakpoints in the session.
Windows PowerShell includes the following aliases for Get-PSBreakpoint
:
gbp