JAEN

PowerShell

ForEach-Object

CautionProcess each item

... | ForEach-Object {処理}

Applies a block per item (short form %). Bulk renames, repeated ops; -Parallel on PS7.

Examples

  • gci *.log | % { Rename-Item $_ ($_.BaseName + '.bak') }Bulk-rename extensions

Syntax

<cmd> | ForEach-Object {$_ ...} / % {...}

Before you run it

Preview targets with gci before bulk changes.

Related commands

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store