Set-PSBreakpoint -Variable idx -Mode Write -Action {
Write-Host -ForegroundColor Red "MyAction: $($idx)"
}
Function Test ($p) {
0..$p | % {
$idx = $_
$idx
}
}
Test 3
Set-PSBreakpoint -Variable idx -Mode Write -Action { Write-Host -ForegroundColor Red MyAction: $($idx) } Function
Share
You can use $MyInvocation e.g.: