I want to ping -a all our pc's on the domain by creating a bat file. Can anyone help me with this probably easy bat file. All the results must go into a txt file.
Or if you know of freeware that will do the trick plesae let me know.
open notepad and enter the following,.
cdping -a
pause
This will perform the ping -a and leave the screen up for you to view. If you dont want it leaving the results on the screen omit the pause, but it will open run and close before you see it. If you want it to save it to a file then add a redirect
cdping -a ip_address > DRIVE_LETTER:\ping.txt
Then save the batch file using save as and name it [whatever you want].bat
What you need to do is probably have a flat text file containing all hostnames on the network like so:
computer1
computer2
computer3
so on so on...
The problem is that I could never get batch to read in the text file and assign each hostname as a varible. So, I learned Perl which I am able to do that. If you are insterested I can help you write the script, which is a ten minute process, and install Perl on your machine. Perl is also free. Just let me know. This will be easy for Perl...
OHHH, but if you want to do it in batch then to only way I can think of to do it is like futuretech204 suggested. The only think that I might change is:
ping -a ip_address > DRIVE_LETTER:\ping.txt
change > to >> which means append to the file. I believe if you use the > symbol the file will be overwritten everytime you call the batch to ping -a a hostname.
to do a "serial" ping to the computernames/ip-addresses you will read from a flat text file just create a very little batch file. It only contains a single line:
for /f %%i in (ipadresses.txt) do ping -a %%i >> pingresult.txt
ipadresses.txt is the text file containing the ip-addresses, one each line, and pingresult will contain the results.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.