newbie help with ping command in a batch file

Giganews Newsgroups
Subject: newbie help with ping command in a batch file
Posted by:  Jeff (Je…@discussions.microsoft.com)
Date: Sun, 5 Mar 2006

Hi..I am new to bat files and need some help..This may be posted in the wrong
forum but thought I would try it here...

Basically I want to write a batch file (unless easier way) to ping one of
our routers with 1024 byte packets, if it times out I want to write it to a
file and then ping that router normally and output that result to a file(
seperate or same )...Then start the process over...I am sure I need some kind
of sleep command in here to keep it from crashing and I also need to somehow
add a timestamp to the failures...So I need a 1024 byte ping, if fails then
output to log, do a normal ping and output it and then start process over..

Quickly I came up with :

:start
  ping -n 1 <name> -l 1024 | find "bytes"
  if not errorlevel 1 goto start
  now>>c:\1024.txt
  ping -n 1 <name> >>c:\32.txt
  goto start

It does work like I want it to as you can imagine...I am going to play
around some more but any help would be greatly appreciated..

Thanks..

Replies