1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| public void uneMéthodeAppelante(){
List listIp = ....;
.......
for(int i=0; i<listIp.size();i++)
{
lancerScan(listIp.get(i));
}
}
public void lancerScan(String ip){
String cmd = null;
try
{
cmd= "Executable\\ipscan.exe "+ip+" -h Temp\\Ping.txt";
Runtime ipscan = Runtime.getRuntime();
Process lancement =ipscan.exec(cmd);//lancement de la commande
lancement.waitFor();//on attend que la commande soit finie pour en lancer une autre
}
catch(Exception e)
{
System.out.println("erreur d'execution " + cmd[i] + e.toString());
}
} |