Set-PSBreakpoint -Variable idx -Mode Write -Action {
Write-Host -ForegroundColor Red "MyAction: $($idx)"
}
Function Test ($p) {
0..$p | % {
$idx = $_
$idx
}
}
Test 3
views:
13answers:
1
+3
A:
You can use $MyInvocation e.g.:
Set-PSBreakpoint -Variable idx -Mode Write -Action {
Write-Host -ForegroundColor Red "$($MyInvocation.MyCommand.Name): $($idx)"
}
Keith Hill
2010-10-23 20:05:03
Thanks Keith. I tried $MyInvocation.ScriptNamem and of course it didn't work.
Doug Finke
2010-10-24 00:54:02