Batch file to run ping

hi all,

I have a client who is having some intermittent network issue but it is proving difficult to tie down as every time I look all is fine. So..... what I would like to do is place a batch file on her desktop to do the following:

Ping for 10 minutes and output the result to google.txt file
Ping her default gateway for 10 minutes and output the result to router.txt file
Ping another host on the network for 10 minutes and output the result to host.txt file

All I would want her to do is double click the file and carry on with her work. I can take a look at the 3 text files later.

I would like all pings to run at once.

Gareth McKeeCEO/OwnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fred MarshallPrincipalCommented:
I run this one all the time i.e. continuously and start it when the computer boots.  It's a little different than what you want.  But, you can run 3 instances of it - one for each target address.  If I recall, you will want to rename the target log files in each one so there's no conflict in writing to them.
Dan CraciunIT ConsultantCommented:
I'm sure there will be some experts that will provide you with the solution you need.
I just want to make a suggestion: instead of ping use hrping ( ) .
It has a -T option that will output a timestamp on each line. Very useful in doing something like this:
hrping -t -T > google.txt

Steven CarnahanNetwork ManagerCommented:
And to add one more caution.  Ping can sometimes act as a keep alive resulting in the line staying up for the 10 minutes it is running and then dropping when the line goes "idle"
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Steve KnightIT ConsultancyCommented:
Probably a bit more than you want but I have a script of mine here which you can get it to ping a list of hosts every so often, and log it.  Together with second script you can schedule or get her to run which emails you the log file.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Performing Ping tests isn't something you can rely on. But if you do not have anything better, they can give you a starting point.
@echo off
setlocal EnableDelayedExpansion

set log=c:\temp\ee\pingresults.log

for /L %%I in (1,1,36000) do ^
for %%T in (%targets) do (
   ping -n 1 -w 100 %%T >nul && set ok=y|| set ok=n
   echo %date% %time% %%T - !ok! 
) >> %log%

Open in new window

This will log into a single file, with a timeout of 100 ms per ping, and then wait one second; repeated for about 10 minutes. Each ping will have a timestamp.
Steve KnightIT ConsultancyCommented:
Thanks for selecting my answer, did you try it, got everything you need?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.