Comunidad de diseño web y desarrollo en internet online

batch para ping que muestre tiempo y ttl

Citar            
MensajeEscrito el 17 Jul 2008 05:47 pm
Buenos dias alguien me puede ayudar con este codigo

Necesito que me muestre los resultados del ping solo el tiempo de respuesta y la tasa de transmision ttl separada por comas o tabuluaciones

este es el codigo

@echo off > pingresult.txt

for /f "tokens=* delims=," %%I in (C:\GESTEL\tcp\cambia_vel\ping\equipos.txt) do call :sub1 %%I
goto :eof

:sub1

ping -n 2 %1 > C:\GESTEL\tcp\cambia_vel\ping\pinglog.txt

find /i "unknown host" < pinglog > nul
if not errorlevel 1 set status=down

find /i "reply" < pinglog > nul
if not errorlevel 1 set status=up

find /i "expired in transit" < pinglog > nul
if not errorlevel 1 set status=expired in transit

find /i "Request timed out" < pinglog > nul
if not errorlevel 1 set status=down

> pingresult.txt echo %*, %time%, %status%

goto :eof
:: DONE

hasta el momento funciona bien, pero no se por que en los resultados me sale

200.93.131.1, 12:44:50.43, up

estos valores no coindicen con estos



Pinging 200.93.131.1 with 32 bytes of data:



Reply from 200.93.131.1: bytes=32 time=2ms TTL=255

Reply from 200.93.131.1: bytes=32 time=8ms TTL=255



Ping statistics for 200.93.131.1:

Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 2ms, Maximum = 8ms, Average = 5ms


alguien me puede orientar como hace eso??? necesito cargar esos resultados en una base de datos

gracias

Por willicito

0 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 29 Mar 2010 11:51 pm
bro, intente tu codigo para saber si una lista de ips tenian conectividad pero no me corrio, te paso un code que si me funciono:

@echo off
SetLocal EnableDelayedExpansion


echo Enviando ping a los equipos...
echo ------------------------------

for /f "tokens=* delims=," %%a in (sitios.txt) do (

ping -n 2 %%a

if !ERRORLEVEL! == 0 echo ip: %%a hora:%time%>> alive.txt

if !ERRORLEVEL! == 1 echo ip: %%a hora:%time% >> dead.txt


>> resultado_general.txt echo ip: %%a, hora: %time%, status: !ErrorLevel!

)

EndLocal
start resultado.txt
pause

Por iekzaer

7 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.