Hey everyone! I'm diving into PowerShell scripting and could use some help with a setup I have. I've created a main PowerShell script intended to run other scripts that are located in separate subfolders. The idea is to execute scripts like code1.ps1, code2.ps1, etc., in a specific order, ensuring each script finishes before the next one kicks off.
The problem I'm running into is that despite using the -Wait command, it seems to stall at the last executed script, and I'm required to manually close the window to proceed with the next one. I also tried using -NoExit, but I get an error saying that parameter can't be found.
Here's a snippet of my main script for reference:
...
Can anyone guide me on how to fix this? I appreciate any tips or advice!
1 Answer
Instead of using `& start powershell {.code1.ps1} -Wait`, just go with `. .code1.ps1`. This will execute the script in the current context and should resolve your issue. Repeat this for the other scripts as well!

Thanks for the tip! Code is running smoothly right now. I’ll keep you updated if it all completes correctly!