![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #11 (permalink) |
| | Re: get-child item question from a newbie On Aug 29, 11:00 am, "Keith Hill [MVP]" <r_keith_h...@xxxxxx_no_spam_I> wrote: Quote: > <powershel...@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 what I ended up getting to work get-ChildItem * | where {$_.PSIsContainer} | set-Location -passthru | foreach {sub\junk} so for each subdir I am running another command which is always located in a dir called sub full structure c:\test\sample\sub\<junk.exe> c:\test\sample1\sub\<junk.exe> c:\test\sample2\sub\<junk.exe> c:\test\sample3\sub\<junk.exe> I run the command above from \test and it runs each instance of junk.exe from within \sample* dir THANKS! |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| how to show the name of child item after its in the pipeline? | PowerShell | |||
| Re: Newbie Question | Live Mail | |||
| Newbie Question #3 | General Discussion | |||
| RE: Newbie Question | PowerShell | |||