Gotcha Return in the pipeline

suggest change
get-childitem | foreach-object { if ($_.IsReadOnly) { return } }

Pipeline cmdlets (ex: ForEach-Object, Where-Object, etc) operate on closures. The return here will only move to the next item on the pipeline, not exit processing. You can use break instead of return if you want to exit processing.

get-childitem | foreach-object { if ($_.IsReadOnly) { break } }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents