Remove-PSBreakpoint

从当前控制台中删除断点。

语法

Breakpoint (默认值)

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

Id

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

说明

Remove-PSBreakpoint cmdlet 删除断点。 输入断点对象或断点 ID。

删除断点时,断点对象不再可用或功能。 如果在变量中保存了断点对象,则引用仍然存在,但断点不起作用。

Remove-PSBreakpoint 是用于调试 PowerShell 脚本的多个 cmdlet 之一。 有关 PowerShell 调试器的详细信息,请参阅 about_Debuggers

示例

示例 1:删除所有断点

此命令删除当前控制台中的所有断点。

Get-PSBreakpoint | Remove-PSBreakpoint

示例 2:删除指定的断点

此命令删除断点。

$B = Set-PSBreakpoint -Script "sample.ps1" -Variable "Name"
$B | Remove-PSBreakpoint

Set-PSBreakpoint cmdlet 在 $Name 脚本中的 Sample.ps1 变量上创建断点,并将断点对象保存在 $B 变量中。 Remove-PSBreakpoint cmdlet 将删除新的断点。 它使用管道运算符(|)将 $B 变量中的断点对象发送到 Remove-PSBreakpoint cmdlet。

由于此命令,如果运行脚本,它将在不停止的情况下运行到完成。 此外,Get-PSBreakpoint cmdlet 不会返回此断点。

示例 3:按 ID 删除断点

此命令删除断点 ID 为 2 的断点。

Remove-PSBreakpoint -Id 2

示例 4:使用函数删除所有断点

此简单函数删除当前控制台中的所有断点。

function del-psb { Get-PSBreakpoint | Remove-PSBreakpoint }

它使用 Get-PSBreakpoint cmdlet 来获取断点。 然后,它使用管道运算符(|)将断点发送到 Remove-PSBreakpoint cmdlet,这将删除它们。

参数

-Breakpoint

指定要删除的断点。 输入包含断点对象的变量或获取断点对象的命令,例如 Get-PSBreakpoint 命令。 还可以通过管道将断点对象传递给 Remove-PSBreakpoint

参数属性

类型:

Breakpoint[]

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

参数集

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

-Confirm

在运行 cmdlet 之前,提示你进行确认。

参数属性

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

参数集

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

-Id

指定此 cmdlet 删除断点的断点 ID。

参数属性

类型:

Int32[]

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

参数集

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

-WhatIf

显示 cmdlet 运行时会发生什么情况。 命令脚本未运行。

参数属性

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

参数集

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

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

Breakpoint

可以通过管道将断点对象传递给此 cmdlet。

Int32

Runspace

输出

None

此 cmdlet 不返回任何输出。

备注

Windows PowerShell 为 Remove-PSBreakpoint提供以下别名:

  • rbp