Pipelines

View saved

Pipe objects, not just text

The right side receives objects from the left. Parameters often bind by pipeline.

Get-Process | Sort-Object CPU -Descending | Select-Object -First 5

Measure and select

Count or pick properties as you learn.

Get-ChildItem | Measure-Object
Get-ChildItem | Select-Object Name, Length

ForEach-Object

Run a script block for each incoming object. $_ is the current item.

Get-ChildItem -File | ForEach-Object { $_.Name.ToUpper() }

Stop early while exploring

Use Select-Object -First so huge lists do not flood the console.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.