Is there any difference between ForEach and ForEach-Object ?
I have a small code like this, works fine
$txt = Get-Content \
foreach is an alias of ForEach-Object but it appears to also be a keyword (which is confusing).
The foreach ($ syntax you are using is help about_foreach.
The foreach as ForEach-Object alias is help ForEach-Object.
The keyword foreach operates over each $ in the $ as given in the () bit.
The alias foreach/function ForEach-Object operates over each item of the collection it receives as input.