Powershell.Chunks is a Powershell cmdlet that splits an array into arrays each not exceeding the given size. The cmdlet preserve or reverse the order of elements depending on the sign of the parameter size.
'a','b','c','d','e' | Get-Chunk 2 # Returns @( @('a','b'), @('c','d'), @('e') )
Get-Chunk -3 -InputObject @(1,2,3,4,5,6,7,8) # Returns @( @(8,7,6), @(5,4,3), @(2,1) )More Examples.
Automatic install the module from the PowerShell Gallery:
Install-Module -Name Powershell.Chunks
Import-Module Powershell.ChunksAutomatic install the module from the NuGet.org:
nuget install mazzy.Powershell.Chunksor manual:
- Download and unblock the latest .zip file.
- Extract the .zip into your
$PSModulePath, e.g.~\Documents\WindowsPowerShell\Modules. - Ensure the extracted folder is named
Powershell.Chunks. - Set an execution policy to
RemoteSignedorUnrestrictedto execute not signed modulesSet-ExecutionPolicy RemoteSigned. - Run
Import-Module Permutation.
This project is released under the licensed under the MIT License.