次の方法で共有


Disable-PSBreakpoint

Disables the breakpoints in the current console.

構文

Breakpoint (既定)

Disable-PSBreakpoint
    [-Breakpoint] <Breakpoint[]>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Id

Disable-PSBreakpoint
    [-Id] <Int32[]>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

説明

The Disable-PSBreakpoint cmdlet disables breakpoints, which assures that they are not hit when the script runs. You can use it to disable all breakpoints, or you can specify breakpoints by submitting breakpoint objects or breakpoint IDs.

Technically, this cmdlet changes the value of the Enabled property of a breakpoint object to False. To re-enable a breakpoint, use the Enable-PSBreakpoint cmdlet. Breakpoints are enabled by default when you create them by using the Set-PSBreakpoint cmdlet.

A breakpoint is a point in a script where execution stops temporarily so that you can examine the instructions in the script. Disable-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: Set a breakpoint and disable it

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

These commands disable a newly-created 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 Disable-PSBreakpoint cmdlet to disable the new breakpoint. It uses a pipeline operator (|) to send the breakpoint object in $B to the Disable-PSBreakpoint cmdlet.

As a result of this command, the value of the Enabled property of the breakpoint object in $B is False.

Example 2: Disable a breakpoint

PS C:\> Disable-PSBreakpoint -Id 0

This command disables the breakpoint with breakpoint ID 0.

Example 3: Create a disabled breakpoint

PS C:\> Disable-PSBreakpoint -Breakpoint ($B = Set-PSBreakpoint -Script "sample.ps1" -Line 5)
PS C:\> $B

This command creates a new breakpoint that is disabled until you enable it.

It uses the Disable-PSBreakpoint cmdlet to disable the breakpoint. The value of the Breakpoint parameter is a Set-PSBreakpoint command that sets a new breakpoint, generates a breakpoint object, and saves the object in the $B variable.

Cmdlet parameters that take objects as their values can accept a variable that contains the object or a command that gets or generates the object. In this case, because Set-PSBreakpoint generates a breakpoint object, it can be used as the value of the Breakpoint parameter.

The second command displays the breakpoint object in the value of the $B variable.

Example 4: Disable all breakpoints in the current console

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

This command disables all breakpoints in the current console. You can abbreviate this command as: "gbp | dbp".

パラメーター

-Breakpoint

Specifies the breakpoints to disable. 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 the Disable-PSBreakpoint cmdlet.

パラメーターのプロパティ

型:

Breakpoint[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

Breakpoint
配置:0
必須:True
パイプラインからの値:True
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Confirm

Prompts you for confirmation before running the cmdlet.

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False
Aliases:cf

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-Id

Specifies an array of IDs or variables that contains the breakpoint IDs. You cannot pipe IDs to Disable-PSBreakpoint.

パラメーターのプロパティ

型:

Int32[]

規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

Id
配置:0
必須:True
パイプラインからの値:False
プロパティ名別のパイプラインからの値:True
残りの引数からの値:False

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

パラメーターのプロパティ

型:SwitchParameter
規定値:None
ワイルドカードのサポート:False
DontShow:False

パラメーター セット

(All)
配置:Named
必須:False
パイプラインからの値:False
プロパティ名別のパイプラインからの値:False
残りの引数からの値:False

-WhatIf

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

パラメーターのプロパティ

型:SwitchParameter
規定値:False
ワイルドカードのサポート:False
DontShow:False
Aliases:wi

パラメーター セット

(All)
配置: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 a breakpoint object to Disable-PSBreakpoint.

出力

None or System.Management.Automation.Breakpoint

When you use the PassThru parameter, Disable-PSBreakpoint returns an object that represents the disabled breakpoint. Otherwise, this cmdlet does not generate any output.