Let´s say I have here a text file with some computer names (each line == 1 name):
computerA
computerB
computerC
...
Is it possible to create a batch file that is pinging all of these computers? And actually a ping is a big output. I don't need the time or other information; I just would like to know reachable or not. Any ideas?
It´s working now! The problem was like fox said, that I named my batch file as ping.bat and ping is also a command so this did not work out. I renamed my batch file and now everything is fine.
Answer
Try this:
@echo off
for /f "delims=" %%a in (computerlist.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond)
pause
If you have to use a filename or path with spaces or odd characters then Instead of (computerlist.txt) use ( ' type "c:\folder\computer file.txt" ' )
No comments:
Post a Comment