Can Powershell Loop Through a Collection N objects at a time?

后端 未结 4 1447
感情败类
感情败类 2020-12-16 08:10

I am wondering how one would tackle looping through a collection of objects, processing the elements of that collection in groups instead of singularly, as is the case in no

4条回答
  •  清酒与你
    2020-12-16 08:27

    I've got this:

     $array = 1..100
     $group = 10
     $i = 0
    
     do {
         $array[$i..(($i+= $group) - 1)]
         '*****'
         }
          until ($i -ge $array.count -1)
    

提交回复
热议问题