Call Powershell script from Batch, wait for completion

I’m trying to make my batch script (Test.bat) wait until the Powershell script (TheScriptToBeExecuted.ps1) it calls finishes. Here is the content of the batch script:

call powershell.exe -executionpolicy remotesigned -File TheScriptToBeExecuted.ps1

exit /b

I’ve tried using START /wait but it didn’t help. When I double click on the Test.bat file, it seems to be waiting, yet when it’s called from another script, it doesn’t wait. How can I make my batch script wait for the Powershell script to finish?

You can use the start command with the /wait option to launch Powershell and wait for it to finish. Here’s the updated content of your batch script:

start /wait powershell.exe -executionpolicy remotesigned -File TheScriptToBeExecuted.ps1

exit /b