tags:

views:

47

answers:

1

I want to iterate over files in a folder using powershell script;

+2  A: 
Get-ChildItem | ForEach-Object { <# do what you need to do #> }

or shorter:

gci | % { <# ... #> }

or if you want an explicit looping construct:

foreach ($file in Get-ChildItem) {
    # ...
}
Joey
*sigh* Is there a way of getting useful syntax highlighting on SO? It mangles block comments as well :-(
Joey