小编Sto*_*ffi的帖子

powershell,foreach,获取行数

有没有可能得到 $_. foreach管道中的变量?

例子:

$a = 1..9
$a | foreach {if ($_ -eq 5) { "show the line number of $_"}}
Run Code Online (Sandbox Code Playgroud)

我希望你知道我的意思。

谢谢!

powershell foreach

1
推荐指数
1
解决办法
5667
查看次数

标签 统计

foreach ×1

powershell ×1