View Single Post
Old 08-29-2007   #6 (permalink)
Keith Hill [MVP]


 
 

Re: get-child item question from a newbie

<powersheller@xxxxxx> wrote in message
news:1188399013.650799.260310@xxxxxx
Quote:

> First of all, I want to thank everyone that has offered suggestions.
> I'm still a bit stumped on this.
> as far as I can tell the solutions don't address the fact that I just
> want to step one level deep from the current dir and run a specific
> command (in this case it's actually a script that must be run from
> current dir, I can't just run it from a different dir with the correct
> path.) and then I need to go back up one dir and then back down into
> the next dir and run the same command.
> I don't think I need -recurse because I don't want to go deeper than
> the one level.
Missed that part - sorry. Then this should work for you:

get-item * | where {$_.PSIsContainer} | set-location -passthru | foreach {
c:\myscript.ps1}

get-item * will get the items (files/folders) in the current directory and
pass them to the where filter which filters out the files.

--
Keith

My System SpecsSystem Spec