Remove-PSBreakpoint

Deletes breakpoints from the current console.

语法

Breakpoint (默认值)

Remove-PSBreakpoint
    [-Breakpoint] <Breakpoint[]>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Id

Remove-PSBreakpoint
    [-Id] <Int32[]>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

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.

示例

Example 1: Remove all breakpoints

PS C:\> Get-PSBreakpoint | Remove-PSBreakpoint

This command deletes all of the breakpoints in the current console.

Example 2: Remove a specified breakpoint

PS C:\> $B = Set-PSBreakpoint -Script "sample.ps1" -Variable "Name"
PS C:\> $B | Remove-PSBreakpoint

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.

Example 3: Remove a breakpoint by ID

PS C:\> Remove-PSBreakpoint -Id 2

This command deletes the breakpoint with breakpoint ID 2.

Example 4: Use a function to remove all breakpoints

PS C:\> function del-psb { get-psbreakpoint | remove-psbreakpoint }

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.

参数

-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.

参数属性

类型:

Breakpoint[]

默认值:None
支持通配符:False
不显示:False

参数集

Breakpoint
Position:0
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

Prompts you for confirmation before running the cmdlet.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Id

Specifies breakpoint IDs for which this cmdlet deletes breakpoints.

参数属性

类型:

Int32[]

默认值:None
支持通配符:False
不显示:False

参数集

Id
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:wi

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

输入

Breakpoint

You can pipe breakpoint objects to Remove-PSBreakpoint.

输出

None

The cmdlet does not generate any output.