Remove-PSBreakpoint
從目前的主控台刪除斷點。
語法
Breakpoint (預設值)
Remove-PSBreakpoint
[-Breakpoint] <Breakpoint[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Id
Remove-PSBreakpoint
[-Id] <Int32[]>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Remove-PSBreakpoint Cmdlet 會刪除斷點。 輸入斷點對象或斷點標識碼。
當您移除斷點時,斷點對象將無法再使用或運作。 如果您已將斷點物件儲存在變數中,則參考仍然存在,但斷點無法運作。
Remove-PSBreakpoint 是數個專為偵錯 Windows PowerShell 腳本而設計的 Cmdlet 之一。 如需 Windows PowerShell 調試程式的詳細資訊,請參閱about_Debuggers。
範例
範例 1:移除所有斷點
PS C:\> Get-PSBreakpoint | Remove-PSBreakpoint
此命令會刪除目前控制台中的所有斷點。
範例 2:移除指定的斷點
PS C:\> $B = Set-PSBreakpoint -Script "sample.ps1" -Variable "Name"
PS C:\> $B | Remove-PSBreakpoint
此命令會刪除斷點。
第一個命令會使用 Set-PSBreakpoint Cmdlet,在 Sample.ps1 腳本的 Name 變數上建立斷點。 然後,它會將斷點物件儲存在$B變數中。
第二個命令會使用 Remove-PSBreakpoint Cmdlet 來刪除新的斷點。
它會使用管線運算符 (|) 將$B變數中的斷點對象傳送至 remove-PSBreakpoint Cmdlet
由於此命令,如果您執行腳本,它會在不停止的情況下執行至完成。 此外,Get-PSBreakpoint Cmdlet 不會傳回此斷點。
範例 3:依標識符移除斷點
PS C:\> Remove-PSBreakpoint -Id 2
此命令會刪除具有斷點標識碼 2 的斷點。
範例 4:使用函式移除所有斷點
PS C:\> function del-psb { get-psbreakpoint | remove-psbreakpoint }
這個簡單函式會刪除目前控制台中的所有斷點。 它會使用 Get-PSBreakpoint Cmdlet 來取得斷點。 然後,它會使用管線運算符 (|) 將斷點傳送至 Remove-PSBreakpoint Cmdlet,以刪除它們。
因此,您可以輸入 del-psb,而不是較長的命令。
若要儲存函式,請將它新增至您的 Windows PowerShell 配置檔。
參數
-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 刪除斷點的斷點標識碼。
參數屬性
| 類型: | 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
您可以使用管線將斷點物件傳送至 remove-PSBreakpoint
輸出
None
Cmdlet 不會產生任何輸出。