02 Votes

Batch Script: Start program and wait until it is finished

Question by Sledge | Last update on 2021-04-06 | Created on 2012-08-05

I need a batch script for Windows, with which I can start a program. Certainly, the next line in the script, should only be performed after the first program has been terminated.

Until now, I am using the following batch script to start two programs in succession:

@echo off
program1.exe parameter1 parameter2
program2.exe parameter1 parameter2

However, this starts the programs directly after each other. Instead, the script should start the second program only after the first one is finished. Can I achieve this somehow?

ReplyPositiveNegativeDateVotes
Avatar
13 Votes

Yes, you can. Just rewrite your script in this way:

@echo off
start /wait program1.exe parameter1 paramater2
start /wait program2.exe paramater1 paramater2

With "start /wait", you start the program and wait for the program until it has been executed and terminated again. Only after that, the next line of the batch script will be processed.
Last update on 2021-04-06 | Created on 2012-08-06

ReplyPositive Negative
Avatar
00 Votes

@echo off
programm1.exe parameter1 parameter2 | pause
programm2.exe parameter1 parameter2
2021-04-04 at 21:33

ReplyPositive Negative
Reply

Related Topics

How to edit a Batch Script

Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.