USing loop in powershell to run different .exe files at different locations.

Please check the below screenshot.

The first command in powershell is running fine, however I need to run the same command for 8 different .exe files. I have mentioned the paths where I need to run the command.

Assist if any idea how I can put those in a loop and run the script for all simultaneously.
Aakash AggarwalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

@aakash It would be more helpful if you could paste your script content in code blocks rather than in a PNG format. This would make it faster to answer your question and not have to rewrite all the code.
You could try this :

 I am presenting the code untested.

$myscript =  "D:\script_run\mysql.xml"
$xml = [xml](get-content $myscript)
$EnvironmentCode = $xml.Synergetic.Parameters.EnvironmentCode
$SERVERNAME = $xml.$Envi.Synergetic.Parameters.SQLServerName
$LOGINUSERNAME = $xml.$Envi.Synergic.Parameters.LOGINUSERNAME
$LOGINPASSWORD = $xml.$Envi.Syergetic.Parameters.LOGINPASSWORD
$DBNAME = $xml.$Envi.Synergetic.Parameters.DBNAME

Function  invoke-script($Path){
        set-location $path
        & Synergetic.Application.CreateConfigCommandLine.exe /SERVERNAME = "$SERVERNAME" /LOGINUSERNAME = "$LOGINUSERNAME" /DBNAME = "$DBNAME" /CONSOLELOG=1


#invoke-script -Path "D:\InetPub\wwwroot\" 
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\OnlineApplication\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCommunityPortal\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\CoreAPI\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\EventBooking\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\OnlineApplication\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\OnlineEnquiry\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\SunAPI\BinConfig"
invoke-script -Path "D:\InetPub\wwwroot\SynergeticCore\WebService\BinConfig"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Changed the Code a little bit. I wasn't sure if you had an executable in "
invoke-script -Path "D:\InetPub\wwwroot\" 

Open in new window

If you don't just remove the line or comment it out.

Please note: I typed all that freehand so there are probably some typo's
Aakash AggarwalAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.