ping ping command

0

I need to make a .bat which when executed start the command of ping .

But I need to "ping" several IPs automatically and in case of a certain IP does not respond, that it presents a message and then later asks to press a key to continue and so continue to ping until the last IP. >

So far I have achieved this:

echo off
t
cls
color 1f
title APLICATIVO PARA GERENCIAMENTO DE REDES

:menu
time /t
date /t 

echo     ______________________________________________      
echo.                           
echo         SELECIONE UMA DAS OPCOES ABAIXO      
echo.                           
echo.                           
echo            (1) EXIBIR IP (simples)          
echo            (2) EXIBIR IP (completo)
echo            (3) EXCUTAR PING                
echo     ______________________________________________
echo.
echo.

set /p op= DIGITE UMA OPCAO 

if %op% equ 1 goto 1
if %op% equ 2 goto 2
if %op% equ 3 goto 3

:1 

ipconfig 
time /t >> c:\relatorio.txt
date /t >> c:\relatorio.txt
ipconfig >> c:\relatorio.txt

goto menu

:2

ipconfig /all
time /t >> c:\relatorio.txt
date /t >> c:\relatorio.txt
ipconfig /all >> c:\relatorio.txt


goto menu

:3

echo Digite o IP
set /p ip =
echo Qual o numero requisições?
set /p num = 

if "%num%"  == "0" ( 
ping -t %ip%
pause
) else (

ping %ip%
echo.
echo Fim do comando ping!
pause
)

goto menu
    
asked by anonymous 23.02.2015 / 20:57

1 answer

2

If it's just ips I do it like this:

search for term "100%" where ping is "100% failed"

ping x.x.x.x | find "100%"
if "%errorlevel%" equ "0" echo FALHOU
    
27.03.2015 / 03:33