Doing Something to Each: ForEach-Object

ForEach-Object runs a script block once for every object the pipeline hands it, with $_ as this item, so one line can rename 200 photos, and -WhatIf goes inside the braces, on the command that makes the change, so you can rehearse first.

Updated

Cheat sheet for the lesson Doing Something to Each: ForEach-Object: ForEach-Object runs a script block once for every object the pipeline hands it, with $_ as this item, so one line can rename 200 photos, and -WhatIf goes inside the braces, on the command that makes the change, so you can rehearse…
Category
PowerShell
Level
Apprentice
Tags
and-psitem, foreach-object, operating-system, powershell, script-block, whatif-and-confirm