On Apr 24, 6:47*am, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com>
wrote:
> RickB wrote:
> > I'm using the following at the moment. >
> > if ($found = Get-ChildItem C:\* -Include $filename -Recurse|select-
> > object -first 1)
> > {Do-SomethingWith $found} >
> Just to make sure I've understood properly, you're wondering if you can
> have the pipeline stop at the first match when you run this part:
> "gci c:\* -inc $filename -rec|select -first 1"
>
> Correct?
>
> Marco I think the short answer is Yes.
Until recently, Windows was never my primary environment.
My 'native' environment is NSK (aka Tandem) where machines
usually have 16 cpu's. Everything executes in a pipeline.
Most are dynamic and steps always execute concurrently.
So I see right away that unless the first step waited until
the last step was done there could be lots of steps in progress
at the point where we decide to stop processing.
I'm not sure of MS intention for PS. Perhaps stopping the
pipeline is easy because steps already wait. If not, or
there is an intention to take advantage of multi-processor
capabilities, it may be necessary to use || vs | or some such
syntax to allow for pipelines that must wait vs those whose
steps can execute concurrently.
Either way, your pipelines are essentially a loop.
Allowing them to be labeled and then making 'break' work
on them like any other loop would certainly be nice.
Later, when concurrency is implemented

you could
just not allow || pipelines to be labeled. That would
force you to throw but, by definition, || needs cleanup
anyway and throwing lets you define what cleanup to do.
If you are already doing concurrent steps then just
reverse things. || can be labeled.