This is easy, but different than using find for example:
Get-ChildItem -File | Foreach {c:\user\local\bin\myprog $_.fullname}
To execute commands on the command line, aliases can make this a bit more concise:
ls -file | % {c:\user\local\bin\myprog $_.fullname}
PowerShell prefers teams that are narrow in focus but that can be piped together to provide many features. In addition, PowerShell binds .NET objects, for example. Get-ChildItem uses System.IO.FileInfo objects. You can then use commands such as Foreach, Where, Select, Sort, Group, Format to control objects piped. If you have the time, I recommend that you check out my free Effective PowerShell e-book.
Keith hill
source share