7

I want to write a batch file that executes another batch file, waits for it to complete the process (i.e. wait till the CMD window closes), then starts another application (.exe). How can I do that? I've tried this but it runs both processes simultaneously:

start "" "C:\Program Files\batch1.bat" /w
start "" "C:\Program Files\process1.exe"

P.S: I'm not sure if it matters, but the batch1.bat file that I mentioned executes a group of programs which takes a few seconds to complete.

1 Answer 1

14

Your basic error is the positioning of /w in the start command: in your command it is a parameter to batch1, not to start. You should use:

start /w "" "C:\Program Files\batch1.bat"

However, it is more efficient not to start a new cmd process and instead use:

call "C:\Program Files\batch1.bat"
2
  • 3
    using start ended up not working for the flow i was using. the "call" command worked perfectly, thanks!
    – brakertech
    Commented Apr 26, 2019 at 14:48
  • can you elaborate on why call works better? I never knew about this until just now
    – Jon Grah
    Commented Aug 6, 2022 at 11:13

You must log in to answer this question.