set checkIP=152.77.173.227 FOR /f "tokens=*" %%i IN ('ping -n 1 -w 1000 %checkIP% ^|findstr /i /C:"perte 0%%" /C:"lost 0%%" ^|find /v "" /C') DO set alive=%%i