Hallo,
I want to make a bat file that performs a ping action.
If the result is request time out than the bat file time.bat has to be activated. The time.bat enters the time that the ping action has failed.
EXAMPLE of ping.bat:
:start
ping www.google.nl -n 20
(After this I don’t now what to do?)
CALL time.bat
GOTO start
EXAMPLE of time.bat:
echo.|TIME >> C:\ping\Data.txt (the time will be enter in the text file Data.txt
Can somebody help me with a function that will activate the time.bat only when there is a request time out?
hii there..im just newbe here...hope this will solve your problems.
try this code:
@echo off
color 0A
title PING TEST By DAYWALKERZ
echo.
echo.
:start
echo. >> C:\ping\Data.txt
echo. TIME>> C:\ping\Data.txt
echo Date: %date% Time:%time% *START PING >> C:\ping\Data.txt
echo.
echo STARTING PING TEST...
echo *********************
echo.
echo Date: %date%
echo Time: %time%
ping google.nl -n 4 |find "Request timed out." && (goto A)
ping localhost -n 60 >nul
goto start
:A
echo Date: %date% Time: %time% *PING FAILED >> C:\ping\Data.txt
ping localhost -n 30 >nul
goto start
ok here the tips.
1st - make sure that you make empty folder on where ever location on your hardrive that called "ping"
example:
C:\ping
2nd - dont put the www infront of the ping site
example:
ping google.nl
3rd - do not ping to long...waste a time ... just make short pings only.
example:
ping google.nl -n 4
4th - timer for every pings. here i set it for 60 sec every ping.you may set it what ever you liked.
example:
ping localhost -n 60 >nul
5th - call or goto, if you call its will popup or runs what you have set.you also may change it what ever you wants.
example:
|find "Request timed out." && (goto A)
- if you wanna call your file such "time.bat"...just change it to "CALL time.bat".but make sure you already make batch file for "time.bat" and make sure you get it full location of it.
example:
|find "Request timed out." && (CALL C:\time.bat)
sample picture:
cmd:
log file:
hopefully will help you solve your problems....
sorry for my broken language...