powershell 新建多维数组时循环出问题,只显示了最后一个值
$name=@("andy","jack","jason","tom")$id=@("10","11","12","13")$score=@("80","90","89"...
$name = @("andy","jack","jason","tom")$id = @("10","11","12","13")$score = @("80","90","89","100")$b = @()$a = "" | select name,id,scoreforeach ($i in $name){$a.name = $iforeach ($ii in $id){$a.id = $ii}foreach ($iii in $score){
$a.score = $iii}$b += $a}$b 展开
$a.score = $iii}$b += $a}$b 展开
1个回答
推荐于2016-07-01 · 知道合伙人软件行家
关注
展开全部
$name = @("andy","jack","jason","tom")
$id = @("10","11","12","13")
$score = @("80","90","89","100")
0..3|%{$b = @()}{
$a = "" | select name,id,score
$a.name=$name[$_]
$a.id=$id[$_]
$a.score=$score[$_]
$b+=$a
}{$b}
记得采纳。
$id = @("10","11","12","13")
$score = @("80","90","89","100")
0..3|%{$b = @()}{
$a = "" | select name,id,score
$a.name=$name[$_]
$a.id=$id[$_]
$a.score=$score[$_]
$b+=$a
}{$b}
记得采纳。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询