Share via


Get-PSBreakpoint

현재 세션에 설정된 중단점을 가져옵니다.

Syntax

Get-PSBreakpoint
   [[-Script] <String[]>]
   [-Runspace <Runspace>]
   [<CommonParameters>]
Get-PSBreakpoint
   [[-Script] <String[]>]
   -Command <String[]>
   [-Runspace <Runspace>]
   [<CommonParameters>]
Get-PSBreakpoint
   [[-Script] <String[]>]
   -Variable <String[]>
   [-Runspace <Runspace>]
   [<CommonParameters>]
Get-PSBreakpoint
   [[-Script] <String[]>]
   [-Type] <BreakpointType[]>
   [-Runspace <Runspace>]
   [<CommonParameters>]
Get-PSBreakpoint
   [-Id] <Int32[]>
   [-Runspace <Runspace>]
   [<CommonParameters>]

Description

cmdlet은 Get-PSBreakPoint 현재 세션에서 설정된 중단점을 가져옵니다. cmdlet 매개 변수를 사용하여 특정 중단점을 가져올 수 있습니다.

중단점은 명령을 검사할 수 있도록 실행이 일시적으로 중지되는 명령 또는 스크립트의 지점입니다. Get-PSBreakpoint 는 PowerShell 스크립트 및 명령을 디버깅하도록 설계된 여러 cmdlet 중 하나입니다. PowerShell 디버거에 대한 자세한 내용은 about_Debuggers 참조하세요.

예제

예제 1: 모든 스크립트 및 함수에 대한 모든 중단점 가져오기

이 명령은 현재 세션의 모든 스크립트 및 함수에 설정된 모든 중단점을 가져옵니다.

Get-PSBreakpoint

예제 2: ID별 중단점 가져오기

이 명령은 중단점 ID가 2인 중단점을 가져옵니다.

Get-PSBreakpoint -Id 2

Function         :
IncrementAction  :
Enabled          :
TrueHitCount     : 0
Id               : 2
Script           : C:\ps-test\sample.ps1
ScriptName       : C:\ps-test\sample.ps1

예제 3: ID를 'Get-PSBreakpoint'로 파이프

이러한 명령은 중단점 ID Get-PSBreakpoint를 에 파이핑하여 중단점을 가져오는 방법을 보여 줍니다.

$B = `Set-PSBreakpoint` -Script "sample.ps1" -Command "Increment"
$B.Id | Get-PSBreakpoint

cmdlet은 Set-PSBreakpoint 스크립트의 Increment 함수에 Sample.ps1 중단점을 만들고 중단점 개체를 변수에 $B 저장합니다. 변수에 있는 $B 중단점 개체의 Id 속성은 중단점 정보를 표시하기 위해 Get-PSBreakpoint cmdlet에 파이프됩니다.

예제 4: 지정된 스크립트 파일에서 중단점 가져오기

이 명령은 파일의 SupportScript.ps1 모든 중단점을 Sample.ps1 가져옵니다.

Get-PSBreakpoint -Script "Sample.ps1, SupportScript.ps1"

이 명령은 다른 스크립트 또는 세션의 함수에서 설정할 수 있는 다른 중단점을 얻지 않습니다.

예제 5: 지정된 cmdlet에서 중단점 가져오기

이 명령은 설정 Read-Host 되는 모든 명령 중단점 또는 Write-Host 파일의 Sample.ps1 명령을 가져옵니다.

Get-PSBreakpoint -Command "Read-Host, Write-Host" -Script "Sample.ps1"

예제 6: 지정된 파일에서 명령 중단점 가져오기

Get-PSBreakpoint -Type Command -Script "Sample.ps1"

이 명령은 Sample.ps1 파일의 모든 명령 중단점을 가져옵니다.

예제 7: 변수별 중단점 가져오기

이 명령은 현재 세션의 변수 및 $Swap 변수에 $Index 설정된 중단점을 가져옵니다.

Get-PSBreakpoint -Variable "Index, Swap"

예제 8: 파일의 모든 줄 및 변수 중단점 가져오기

이 명령은 스크립트의 Sample.ps1 모든 줄 및 변수 중단점을 가져옵니다.

Get-PSBreakpoint -Type Line, Variable -Script "Sample.ps1"

예제 9: 특정 Runspace에서 설정된 중단점 가져오기

이 예제에서는 작업이 시작되고 중단점이 실행될 때 Set-PSBreakPoint 중단점으로 설정됩니다. Runspace는 변수에 저장되고 Runspace 매개 변수를 Get-PSBreakPoint 사용하여 명령에 전달됩니다. 그런 다음 변수의 중단점을 검사할 $breakpoint 수 있습니다.

Start-Job -ScriptBlock {
    Set-PSBreakpoint -Command Start-Sleep
    Start-Sleep -Seconds 10
}

$runspace = Get-Runspace -Id 1

$breakpoint = Get-PSBreakPoint -Runspace $runspace

매개 변수

-Command

지정된 명령 이름에 설정된 명령 중단점의 배열을 지정합니다. cmdlet 또는 함수의 이름과 같은 명령 이름을 입력합니다.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Id

이 cmdlet이 가져오는 중단점 ID를 지정합니다. 쉼표로 구분된 목록에 ID를 입력합니다. 중단점 ID를 .에 파이프할 Get-PSBreakpoint수도 있습니다.

Type:Int32[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Runspace

지정된 Runspace에서 중단점과 상호 작용할 수 있도록 Runspace 개체의 ID를 지정합니다.

이 매개 변수는 PowerShell 7.2에 추가되었습니다.

Type:Runspace
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Script

중단점을 포함하는 스크립트 배열을 지정합니다. 여러 스크립트 파일의 경로(선택 사항) 및 이름을 입력합니다. 경로를 생략하면 기본 위치는 현재 디렉터리입니다.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Type

이 cmdlet이 가져오는 중단점 형식의 배열을 지정합니다. 하나 이상의 형식을 입력합니다. 이 매개 변수에 허용되는 값은 다음과 같습니다.

  • 명령
  • 변수

중단점 유형을 .에 파이프할 Get-PSBreakPoint수도 있습니다.

Type:BreakpointType[]
Accepted values:Line, Variable, Command
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Variable

지정된 변수 이름에 설정된 변수 중단점의 배열을 지정합니다. 달러 기호 없이 변수 이름을 입력합니다.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

입력

Int32

중단점 ID를 이 cmdlet으로 파이프할 수 있습니다.

BreakpointType

중단점 유형을 이 cmdlet으로 파이프할 수 있습니다.

출력

CommandBreakpoint

LineBreakpoint

VariableBreakpoint

Breakpoint

이 cmdlet은 세션의 중단점을 나타내는 개체를 반환합니다.

참고

PowerShell에는 다음 별칭이 포함됩니다.Get-PSBreakpoint

  • 모든 플랫폼:
    • gbp