Run multiple exe in a .bat

Bilou -  
gerardboute Posted messages 4 Status Member -
Bonjour,
Je suis heureux d'entendre que vous travaillez sur un fichier BAT. Voici la manière dont vous pouvez structurer votre script pour s'assurer que chaque application s'installe l'une après l'autre. Vous pouvez utiliser la commande `start /wait` pour exécuter chaque installation de manière séquentielle. Voici un exemple de ce que pourrait être votre fichier BAT :
```bat @echo off start /wait "Installation Flash Player" "chemin\vers\FlashPlayerInstaller.exe" start /wait "Installation DivX Codec" "chemin\vers\DivXCodecInstaller.exe" start "Ouvrir page d'intro" "chemin\vers\votre\page\intro.html" ``` Assurez-vous de remplacer `chemin\vers\` par le chemin réel où se trouvent vos fichiers. Cette méthode attendra que chaque installation soit terminée avant de passer à la suivante.

Bonne chance avec vos installations !

9 answers

  1. Florentcreate
     
    Hello again.

    Well, I just found out how to do it.
    You’re going to laugh as much as I did, it’s really simple ^^
    To launch SETUP.exe located in the current directory, you just need to use the command:
    "SETUP.EXE"

    And there you go, the setup launches, and the best part is that the .bat waits for the installation to finish (when the setup closes)

    So there you go, that should answer the questions ^^.
    Plus, I was able to finish my summary/launcher in autorun ^^

    Your servant.
    Florentcreate
    5
  2. Flocreate
     
    Hello.

    I am creating an autorun to provide a summary/launcher for the movies contained on a DVD.
    I'm using an AUTORUN.INF that launches a .BAT (normal for autorun ^^)
    This .bat consists of a summary that allows you to choose the movie you want to watch.
    Then, I launch the movie with "Media Player Classic", which plays (among other things) AVI files.
    Well, that's easy.

    But wait, I'm complicating things: ^^
    Media Player Classic is a program. This means it's not on every PC in the world ^^
    Therefore, my autorun starts with a .BAT that checks and launches the installation if necessary (basically).
    So here’s a recap:

    AUTORUN.BAT
    ==> Media Player Classic installed --> Launch Lancement.BAT (my summary/launcher...)
    ==> Media Player Classic not installed --> Ask if you want to install
    * YES --> Install --> LAUNCH SETUP.EXE
    * NO --> Explore the DVD


    That's it. The only thing I'm stuck on is launching SETUP.EXE
    IF you have the solution, thank you.

    (If you want the source code, I’ll gladly provide it ^^, just ask)

    Flocreate
    1
  3. floxi Posted messages 153 Status Member 94
     
    I don't really see the problem actually

    if you write
     flashplayer.exe codectrucchose.exe


    In a bat it will install them sequentially, it will wait for the first one to finish before launching the second.

    Otherwise, on XP you can have the CHOICE command by installing Powerbatch, it includes everything needed to make the command work on your OS, and it's free.

    You can download it here http://batcher.ath.cx
    --
    Flox
    1
  4. Ravachol Posted messages 568 Status Member 120
     
    Hi,
    maybe testing ERRORLEVEL?

    A++

    Thought only begins with doubt.
    ROGER MARTIN DU GARD
    0
  5. Bilou
     
    J'ai adapté un petit programme qui a l'air de fonctionner, mais ça me fait une erreur avec l'instruction choice. Il me dit que ce n'est pas reconnu en tant que commande interne. Watizite?

    @echo off :menu cls echo. echo Menu de lancement : echo ------------------- echo 1. Installer le lecteur Flash 7 (si vous ne voyez pas le menu) echo 2. Installer le codec DivX 5.11 (si vous ne voyez pas les vidéos) echo 3. Lancer le CD echo. echo Q. Quitter echo. choice /c:123Q /t:Q,60 /n Votre choix ? if errorlevel 255 goto erreur if errorlevel 4 goto Quitter if errorlevel 3 goto Lance if errorlevel 2 goto InstallDivX if errorlevel 1 goto InstallFlash if errorlevel 0 goto erreur goto fin :erreur echo Il y a eu une erreur. goto fin :Quitter goto fin :InstallDivX start Install/divx511.exe goto menu :InstallFlash start Install/FlashPlayer7.exe goto menu :Lance start index.html goto menu :fin 
    0
    1. phil59110
       
      Install Powerbatch and it will work for the choice command, it is free.
      0
    2. B.Max
       
      ```html
       @echo off :menu cls echo. echo Menu de lancement : echo ------------------- echo 1. Installer le lecteur Flash 7 (si vous ne voyez pas le menu) echo 2. Installer le codec DivX 5.11 (si vous ne voyez pas les vidéos) echo 3. Lancer le CD echo. echo Q. Quitter echo. set choise= set /p choise== /c:123Q /t:Q,60 /n Votre choix ? if errorlevel 255 goto erreur if errorlevel 4 goto Quitter if errorlevel 3 goto Lance if errorlevel 2 goto InstallDivX if errorlevel 1 goto InstallFlash if errorlevel 0 goto erreur goto fin :erreur echo Il y a eu une erreur. goto fin :Quitter goto fin :InstallDivX start Install/divx511.exe goto menu :InstallFlash start Install/FlashPlayer7.exe goto menu :Lance start index.html goto menu :fin 
      ```
      0
  6. Bilou
     
    Well, apparently, choice doesn't work on Windows XP. Shit...

    Does anyone have an alternative solution?
    0
    1. titeuf49
       
      Hi Bilou!!

      Indeed, the choice command doesn't exist under XP (unfortunately)!
      I have the same problem, I'm working on a batch that allows launching several apps using the "IF" commands
      but apparently I'm having some small issues, it might not be the right solution, so like Bilou, I'm looking for the best way to create a menu!!
      If someone could help us, that would be nice
      Thank you and good luck Bilou!!
      0
    2. blux Posted messages 2045 Registration date   Status Moderator Last intervention   3 455
       
      Hi,

      START /W launches an app and waits for it to finish before moving on to the next step...

      This could probably be useful...

      However, using VBScript is still the best for automating tasks... Much more functional than DOS commands under XP (which don't always work as one would expect...)

      I’ve experienced this, I had to rewrite a .BAT file in .VBS

      See you later, Blux
       "The idiots, they dare to do anything. That's how we recognize them" 
      0
    3. gerardboute Posted messages 4 Status Member
       
      Hello
      actually, I created the bat file that allows me to launch the software in exe, but it doesn't work for everyone. I want it to stop asking me about next or continue, I accept and so on; I would like that as soon as I run the bat file, I can sit back and wait for all the software included in the bat to install automatically until the end.
      thank you for the help you will provide.
      0
  7. muntoya Posted messages 396 Status Contributor 72
     
    Good evening,

    To complement what you said titeuf49, Choice.com is not installed under the NT kernels of Windows (NT4/2000/XP). It is indeed a standard Microsoft program distributed with the DOS of the 9x or Millennium versions.

    @+

    Muntoya
    0
    1. piraneo
       
      If you put a wait between your executable launch instructions, it will wait for the first one to finish before launching the next one.
      Test and approve.
      0
  8. mojito
     
    Hello,

    I would like to see the sources of your autorun.inf and your .bat.

    I am a bit in the same situation as you.
    Installing several software if it doesn't exist ...

    Thank you.
    0