Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

ping bat file


  • Please log in to reply
12 replies to this topic

#1 sreez

sreez

  • Members
  • 634 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Dubai(UAE)
  • Local time:08:25 PM

Posted 19 May 2009 - 11:18 AM

Hi All,

Not sure if this topic goes in here. Can some body tell me to write bat file to ping many machines at the same time.


Thanks

Edited by sreez, 19 May 2009 - 11:18 AM.

LIFE is so simple, if you know the reason of your existence at certain place. Treat every step as first one and trust god, friends, relatives and everyone.

 

Its a simple magic trick given to me by one friend also and I am at this stage  :love4u:


BC AdBot (Login to Remove)

 


#2 James K

James K

  • Members
  • 38 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Witham St Hughes, Lincolnshire
  • Local time:05:25 PM

Posted 26 May 2009 - 07:09 AM

Hi Sreez,

to create a batch file simple create a new notepad document and save it as filename.bat and in the file insert the following
ping "ip or hostname"
do that for each machine you want to ping and it will try 4 times and display the output. run the .bat as any normal application to try it
you might want to add pause at the very end to stop the window from closing when it has finished.
This way you wont be able to ping them all concurrently but the method below will allow you to.

alternativly you could just download the tool FreePing from http://www.tools4ever.com/

Hope this helps.

James

Edited by James K, 26 May 2009 - 07:12 AM.


#3 sreez

sreez
  • Topic Starter

  • Members
  • 634 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Dubai(UAE)
  • Local time:08:25 PM

Posted 26 May 2009 - 09:19 AM

Hi James

Thanks for input. Ok I created the notepad file. and entered two line ping 172.24.3.1 -t and 172.24.4.1 -t. When I execute this .bat file it pings only the 172.24.3.1 but not the second machine mentioned there. I also want to add few more machines, where I can execute one files and it pings all the mentioned in that file.

So can you please advise how to that in .bat file as I am interested in that but not any tools.

Thanks,
Shree

LIFE is so simple, if you know the reason of your existence at certain place. Treat every step as first one and trust god, friends, relatives and everyone.

 

Its a simple magic trick given to me by one friend also and I am at this stage  :love4u:


#4 James K

James K

  • Members
  • 38 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Witham St Hughes, Lincolnshire
  • Local time:05:25 PM

Posted 26 May 2009 - 11:30 AM

Hi Sreez,

All a batch file does is exectue commands in the order listed down, you wont be able to use 1 batch file to ping all the machines at the same time. why not make a couple of batch files and run them at the same time if all you want to see is a couple of endless pings?

James

#5 harrythook

harrythook


  • Security Colleague
  • 4,152 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Philadelphia
  • Local time:11:25 AM

Posted 26 May 2009 - 12:52 PM

Sreez, why would you want to ping multiple machines? I cannot see any good reason to do this via a program. Can you explain please?

Veni Vidi Vici
THE FIGHT AGAINST MALWARE

Become a BleepingComputer fan: Facebook

#6 sreez

sreez
  • Topic Starter

  • Members
  • 634 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Dubai(UAE)
  • Local time:08:25 PM

Posted 27 May 2009 - 07:57 AM

Hi

James: I have around 8 machines which I want to keep an eye. So creating those many batch files is not a good idea

Harrythook: The reason I want to do this way instead of tools, there is way to do with the single file, as I fell happy learning this way is good instead of those ready made tools.

Thanks,
Sreez

Edited by sreez, 27 May 2009 - 07:57 AM.

LIFE is so simple, if you know the reason of your existence at certain place. Treat every step as first one and trust god, friends, relatives and everyone.

 

Its a simple magic trick given to me by one friend also and I am at this stage  :love4u:


#7 James K

James K

  • Members
  • 38 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Witham St Hughes, Lincolnshire
  • Local time:05:25 PM

Posted 28 May 2009 - 04:40 AM

There is no way to complete the task you are attempting to do with only 1 open window, using 1 batch file to ping the machines as harry PM'd me would still open as many windows as pings. Are you wanting to monitor this computers throughout the day or only at certain points?


James,

#8 harrythook

harrythook


  • Security Colleague
  • 4,152 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Philadelphia
  • Local time:11:25 AM

Posted 28 May 2009 - 05:21 AM

Try this:
Copy paste into notepad, and save it as a .bat to your desktop. Give it a rip and see what happens :thumbsup:

CD\
del pinginfo.txt
ping 172.24.3.1 >> pinginfo.txt
type pinginfo.txt
ping 172.24.4.1 >> pinginfo.txt
type pinginfo.txt
notepad pinginfo.txt

Veni Vidi Vici
THE FIGHT AGAINST MALWARE

Become a BleepingComputer fan: Facebook

#9 sreez

sreez
  • Topic Starter

  • Members
  • 634 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Dubai(UAE)
  • Local time:08:25 PM

Posted 28 May 2009 - 07:04 AM

Hi

James: I want to do this continuously.As I said I want to execute a single batch to ping all the machines, I dont mind if that file open 8 windows ping all machines continuously.I need not get a report as I will check in between.

Harry: Yes this is format I am looking for but this file does normal ping ie 4times, What I am looking for is continuous ping.

So I tried this

CD\
del pinginfo.txt
ping 172.24.3.1  -t >> pinginfo.txt
type pinginfo.txt
ping 172.24.4.1  -t >> pinginfo.txt
type pinginfo.txt
notepad pinginfo.txt

But that does nothing. As I said I need not get a report but a ping to all machines at all times.

Thanks

LIFE is so simple, if you know the reason of your existence at certain place. Treat every step as first one and trust god, friends, relatives and everyone.

 

Its a simple magic trick given to me by one friend also and I am at this stage  :love4u:


#10 Quick Guide

Quick Guide

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:12:25 AM

Posted 20 July 2012 - 01:24 AM

Hi sreez,
I think that that command with the -T parameter only works on 1 command prompt. so if you really wanna use batch file then you may just do it separately, in other words you will be running plenty of batch files with the -T command( I just don't get it yet saving all the details after a complete continuous ping). Because the logic in the Batch file-saving-to-notepad is A.) Delete existing file with the same name B.) Execute Ping C.)Save every Ping line to notepad D.) View It (meaning show the ping result in CMD and open up the Notepad).

So during the -T command on your CMD, you won't be seeing things like reply, timed out blah blah, but the -T was already executing in the background, so after you issue the CTRL + C and enter Y to discontinue the ping it should save it in its buffer. Try using the -N and put 10 after. like:

(Don't put delete here)
Ping www.igoogle.com -n 10 >>pinginfo.txt
type pinginfo.txt
notepad pinginfo.txt

Try that and when the notepad opens up again, you will see the results of the -T you made in the start. together with the results of the -N 10. haha I dont know if it helps anyway lol.

And if you would want to save the details on the continuous PING I think saving in the notepad is ok, BUT, you may want to consider space(although notepad really doesn't eat up your drive space).

I have monitoring tools which may be able to help you out "at least", free and not free. both in windows.

Why don't you try "HOST MONITOR by KS-Soft.net" its a very powerful industry/enterprise level monitoring tool, it has its 30 days trial, if you wanna buy it , of course(a little too expensive with the thought that its for large enterprises ;D).

And also you wanna try this one also, "PING TESTER - PROFESSIONAL 9.01", I just don't know the policy if its free or not, as I spent many days looking for monitoring tools like this and voala! someone provided me it hehe of course with no charge.

Link for HOST MONITOR
- http://ks-soft.net/
Link for PING TESTER PRO(and I think it really is not free after all haha)
- http://www.softpedia.com/get/Network-Tools/Network-Testing/Ping-Tester-Professional.shtml

both of this saves their details on a file.
Host Monitor uses HTML for you to view the logs, while PTP uses Export to (Notepad or (CSV/Excel)

If ever you need instructions on how to use it, I have made a manual on the how-to's around Host Monitor.

#11 ElBorba

ElBorba

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Location:Seattle, WA
  • Local time:09:25 AM

Posted 27 June 2013 - 10:26 PM

  1. Create a text file called "computers.txt"
  2. Put the names or ip addresses that you want to ping in there, each on a separate line and save it.
  3. Open a cmd prompt in the same directory and type "for /f %i in (computers.txt) do start ping -t %i"
  4. You'll now see that in the taskbar all of the spawned cmd windows are under a single icon. <Shift+Right-click> on that icon and select "Show windows stacked" 
  5. Instant ping HUD.

For some reason I can't make this work from a .bat though. I always have to type it in.

If someone can tell me how to make it run from .bat I'd be a happy man.

Working in a locked-down government environment you can't always pull stuff off of sourceforge or even get .exe's in.

This is simple and it works.



#12 Rodney Honeyman

Rodney Honeyman

  • Members
  • 2 posts
  • OFFLINE
  •  
  • Local time:12:25 PM

Posted 10 July 2013 - 08:27 PM

How about a vbs script?

#13 x64

x64

  • Members
  • 352 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:London UK
  • Local time:05:25 PM

Posted 12 July 2013 - 04:32 PM

How about

start ping -t 192.168.1.30
start ping -t 192.168.1.31
start ping -t 192.168.1.32
start ping -t 192.168.1.33
start ping -t 192.168.1.34

?

 

This opens one command prompt per ping. Is that what you wanted?

 

x64






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users