Bonjour,
je lance plusieurs bat dos via la commande runtime.exec(cmd)
j'aimerais pouvoir attendre la fin de l'execution de chaque commande avant de lancer la nouvelle.
J'ai essayé process.wait() mais ça ne marche pas
voici mon extrait de code
d'avance merci !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 try{ for(int i=0;i<arrCommands.size();i++){ String osName = System.getProperty("os.name" ); if( osName.equals( "Windows XP" ) ){ String[] cmd = new String[5]; cmd[0] = "cmd.exe" ; cmd[1] = "/C" ; cmd[2] = "Start"; cmd[3]= COMMANDS+"ITFCHECK_run.bat"; cmd[4]= INPUTS+arrCommands.get(i); Runtime rt = Runtime.getRuntime(); System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2]+ " " + cmd[3]+ " " + cmd[4]); Process proc = rt.exec(cmd); proc.wait(); } } }
Partager