Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a batch file to run exe files sequentially

I just start to learn how to build batch file. ( on the windows 7 environment)

I want to build the batch file which is able to run .exe files sequentially .

Run batch files sequentially

I was trying to apply above idea but I am not really sure how to apply it

For example, there are three file on the D:/

In "D:/" there are three .exe files.

  1. MyDriver.exe
  2. YouDriver.exe
  3. Mysoftware.exe

And I would like to build batch file which is running three exe files sequentially

Possible scenario is..

  1. Run batch file
  2. Run MyDriver.exe
  3. MyDriver file's install GUI pops up and then user start to install Mydriver
  4. Done with MyDriver.exe
  5. Run YouDriver.exe
  6. YouDirver file's install GUI pops up and then user start to install YouDriver
  7. Done with YouDriver.exe
  8. Run MySoftware.exe
  9. MySofrware install interface pops up and then user start to install MySoftware
  10. Done exit batch file.

I am not really sure if batch files can do it or not...

if it is impossible , is there any other options to build it ???

thanks

like image 730
Dc Redwing Avatar asked Nov 14 '13 02:11

Dc Redwing


1 Answers

You actually don't need to do anything special to make this happen; batch files are synchronous by default, so execution of the batch file will pause when an executable is launched, and resume when it exits. Something as simple as this should do:

@echo off
REM "@echo off" prevents each line from being printed before execution,
REM and is optional
REM "REM" introduces a comment line
D:\MyDriver.exe
D:\YouDriver.exe
D:\MySoftware.exe

Of course, if you're interested in checking the return values of the programs, to see whether they succeeded or failed to install (assuming the installer provides that information), then things become slightly more complicated; if that's what you need, mention it in a comment, and I'll expand my answer accordingly.

like image 53
Aaron Miller Avatar answered Oct 07 '22 23:10

Aaron Miller