Remove-PSBreakpoint
Published: February 29, 2012
Updated: August 15, 2012
Applies To: Windows PowerShell 2.0, Windows PowerShell 3.0
Remove-PSBreakpoint
Aliases
The following abbreviations are aliases for this cmdlet:
- rbp
Syntax
Parameter Set: Breakpoint Remove-PSBreakpoint [-Breakpoint] <Breakpoint[]> [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: Id Remove-PSBreakpoint [-Id] <Int32[]> [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Remove-PSBreakpoint cmdlet deletes a breakpoint. Enter a breakpoint object or a breakpoint ID.
When you remove a breakpoint, the breakpoint object is no longer available or functional. If you have saved a breakpoint object in a variable, the reference still exists, but the breakpoint does not function.
Remove-PSBreakpoint is one of several cmdlets designed for debugging Windows PowerShell scripts. For more information about the Windows PowerShell debugger, see about_Debuggers.
Parameters
-Breakpoint<Breakpoint[]>
Specifies the breakpoints to delete. Enter a variable that contains breakpoint objects or a command that gets breakpoint objects, such as a Get-PSBreakpoint command. You can also pipe breakpoint objects to Remove-PSBreakpoint.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
1 |
|
Default Value |
None |
|
Accept Pipeline Input? |
true (ByValue) |
|
Accept Wildcard Characters? |
false |
-Id<Int32[]>
Deletes breakpoints with the specified breakpoint IDs.
|
Aliases |
none |
|
Required? |
true |
|
Position? |
1 |
|
Default Value |
None |
|
Accept Pipeline Input? |
true (ByPropertyName) |
|
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
|
Required? |
false |
|
Position? |
named |
|
Default Value |
false |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
|
Required? |
false |
|
Position? |
named |
|
Default Value |
false |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
-
System.Management.Automation.Breakpoint
You can pipe breakpoint objects to Remove-PSBreakpoint.
Outputs
The output type is the type of the objects that the cmdlet emits.
-
None
The cmdlet does not generate any output.
Examples
-------------------------- EXAMPLE 1 --------------------------
This command deletes all of the breakpoints in the current console.
PS C:\> get-breakpoint | remove-breakpoint
-------------------------- EXAMPLE 2 --------------------------
This command deletes a breakpoint.
The first command uses the Set-PSBreakpoint cmdlet to create a breakpoint on the Name variable in the Sample.ps1 script. Then, it saves the breakpoint object in the $b variable.
The second command uses the Remove-PSBreakpoint cmdlet to delete the new breakpoint. It uses a pipeline operator (|) to send the breakpoint object in the $b variable to the Remove-PSBreakpoint cmdlet.
As a result of this command, if you run the script, it runs to completion without stopping. Also, the Get-PSBreakpoint cmdlet does not return this breakpoint.
PS C:\> $b = set-psbreakpoint -script sample.ps1 -variable NamePS C:\>$b | remove-psbreakpoint
-------------------------- EXAMPLE 3 --------------------------
This command deletes the breakpoint with breakpoint ID 2.
PS C:\> remove-psbreakpoint -id 2
-------------------------- EXAMPLE 4 --------------------------
This simple function deletes all of the breakpoints in the current console. It uses the Get-PSBreakpoint cmdlet to get the breakpoints. Then, it uses a pipeline operator (|) to send the breakpoints to the Remove-PSBreakpoint cmdlet, which deletes them.
As a result, you can type "del-psb" instead of the longer command.
To save the function, add it to your Windows PowerShell profile.
PS C:\> function del-psb { get-psbreakpoint | remove-psbreakpoint }
Related topics