gpt4 book ai didi

powershell - 在PowerShell中,是否有一种方法可以检查和打印在 Action block 中命中断点的函数名称?

转载 作者:行者123 更新时间:2023-12-02 23:16:26 25 4
gpt4 key购买 nike

Set-PSBreakpoint -Variable idx -Mode Write -Action { 
Write-Host -ForegroundColor Red "MyAction: $($idx)"
}

Function Test ($p) {

0..$p | % {
$idx = $_
$idx
}
}

Test 3

最佳答案

您可以使用$ MyInvocation例如:

Set-PSBreakpoint -Variable idx -Mode Write -Action {  
Write-Host -ForegroundColor Red "$($MyInvocation.MyCommand.Name): $($idx)"
}

关于powershell - 在PowerShell中,是否有一种方法可以检查和打印在 Action block 中命中断点的函数名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4005612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com