I'm still very new to PowerShell and need some help.
I have some .bat files in a folder named: c:\scripts\run\ and I want to run them one by one, but I donβt know how much I have, it changes from time to time.
So, I want to run a loop with foreach as follows:
foreach ($file in get-childitem c:\scripts\run | where {$_.extension -eq ".bat"})
But I do not know how to run them now. I know that I can run them 1 on 1 as follows:
./run1.bat ./run2.bat ./run3.bat
But how to implement this? Thanks!!
source share