Utiliser les fichiers .bat est la méthode ancienne pour faire des batchs.
Mais, depuis Windows 95, il existe les fichiers .vbs qui permettent de faire plus de choses et plus simplement.
 
Pour le ping, Microsoft donne la solution avec le script vbs suivant
Set objShell = WScript.CreateObject("WScript.Shell" )
 Set objExecObject = objShell.Exec("cmd /c ping -n 3 -w 1000 157.59.0.1" )
 Do While Not objExecObject.StdOut.AtEndOfStream
     strText = objExecObject.StdOut.ReadLine()
     If Instr(strText, "Reply" ) > 0 Then
         Wscript.Echo "Reply received."
         Exit Do
     End If
 Loop  | 
(source http://technet.microsoft.com/fr-fr [...] n-us).aspx )
 
Message édité par olivthill le 09-12-2010 à 14:57:20