, Chunk-Object, , , -InputObject , $InputObject.
, :
echo 1 2 3 4 5 6 7 | Chunk-Object -Process {$_ + 100} -ElementsPerChunk 3
, $_ , $InputObject ( - [object[]]. foreach , $InputObject process. $current_element = $o $current_element = $InputObject, .
, -InputObject:
Chunk-Object -InputObject (echo 1 2 3 4 5 6 7) -Process {$_ + 100} -ElementsPerChunk 3
, , , , -Process, $_, foreach > loop $o, $_ . 100, $current_element {$_ + 100}, 100, $_ NULL. , $_ $o, :
Chunk-Object -InputObject (echo 1 2 3 4 5 6 7) -Process {$o + 100} -ElementsPerChunk 3
$_ , foreach , foreach($o in $InputObject) { $InputObject | %{. , , Chunk-Object , $_ , strong > process , , .
UPDATE:
,
$current_element = & $Process $current_element;
$current_element $Process. , , , , . MyFunction 'foo', foo $_ ; , & {$_ + 100} 'foo' $_ 'foo'. scriptblock {$args[0] + 100}, :
Chunk-Object -InputObject (echo 1 2 3 4 5 6 7) -Process {$args[0] + 100} -ElementsPerChunk 3
, scriptblock , foreach, Foreach-Object ($InputObject | %{), , .