ForEach-Object

say it: “for-EECH OB-jekt” /fɔrˈitʃ ˈɒbdʒɛkt/

Runs code once for each object in the pipeline.

What is ForEach-Object?

ForEach-Object runs a script block once for each object in the pipeline. $_ is the current object.

Get-ChildItem *.txt | ForEach-Object { "$($_.Name) is $($_.Length) bytes" }

Level: Apprentice · More PowerShell terms at this level

Updated