Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Create-Batch

Puts pipeline items into one or more batches

Syntax

Create-Batch
    [[-Size] <ulong>]
    [-InputObject] <Object>
    [<CommonParameters>]

Description

This cmdlet puts the items in the pipeline into batches of a sertain ammount.

Examples

Example 1: Batches of 3 items

This example sents batches of 3 items down the PowerShell pipeline.

0..9 |Create-Batch -Size 3 |ForEach-Object { "$_" }
0 1 2
3 4 5
6 7 8
9

Example 2: Resize batches

This example removes the batches of 3 items and creates new batches of 4 items.

0..9 |Create-Batch -Size 3 |Create-Batch |Create-Batch -Size 4 |ForEach-Object { "$_" }
0 1 2 3
4 5 6 7
8 9

Example 3: Single batch

This creates a single batch (array) containing all the itams The result of this statement is the same as: Get-Process |Set-Content .\Process.txt But note that this appears (for yet unknown reason) about twice as fast. See: PowerShell issue #18070

Get-Process |Create-Batch |Set-Content .\Process.txt

Parameter

The size of the batches (arrays) to be created. If the -Size parameter is omitted (or 0) all current batches will be removed. Note that only the top arrays (batches) will be flattened.

Type:UInt64
Position:0
Default value:[UInt64]::MaxValue
Accept pipeline input:False
Accept wildcard characters:False

The list of items to be put into batches (arrays)

Type:Object
Position:1
Default value:
Accept pipeline input:False
Accept wildcard characters:False

Inputs

A list of items

Outputs

One or more arrays (Object[]) contain the input items

Related Links

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages