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 www.google.ca 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.

Thanks
Gareth
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.
pinglog12.txt
0
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 ( https://www.cfos.de/en/ping/ping.htm ) .
It has a -T option that will output a timestamp on each line. Very useful in doing something like this:
hrping google.ca -t -T > google.txt

HTH,
Dan
0
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"
0
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.

http://scripts.dragon-it.co.uk/links/batch-monitor-ping-email
0

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 targets=www.google.ca 192.168.0.1 192.168.0.123
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.
1
Steve KnightIT ConsultancyCommented:
Thanks for selecting my answer, did you try it, got everything you need?

steve
0
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.