ping Ips command

Asked

Viewed 3,014 times

0

I need to make a .bat that upon being executed starts the command of ping.

But I need to "ping" multiple Ips automatically and in the case of a given IP not responding, that it presents a message and then ask to press a key to continue and so keep pinging until the last IP.

So far I’ve 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
  • 3

    Welcome to Sopt, can you focus on your doubt? , where you can’t move on? it gets easier, and is more understanding if you put the point where you "locked up", the title can be improved as well !

1 answer

2

if it’s just ips I do so:

search term "100%" where on ping return is "100% failure"

ping x.x.x.x | find "100%"
if "%errorlevel%" equ "0" echo FALHOU
  • In case it asks to press a key if it does not reply, then with the above command replacing echo FAILED with pause'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.