For example, given a list 1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8 and a number 4, it returns a list of list with length of 4, that is (1, 2, 3, 4), (5, 6, 7, 8),
1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8
(1, 2, 3, 4), (5, 6, 7, 8),
$a = 1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,0 $b = 0..([Math]::ceiling($a.Length / 4) - 1) | % { @(, $a[($_*4)..($_*4 + 4 - 1)]) }
Don't know why I had to put a comma after (.
(