bbcac
asked on
Ping Script or Batch File
I am looking for a VBScript or BAT file that can ping a list of computers and output the results to a text file.
ASKER
that doesn't seems to work... here is my output file
Processing aComputerName
---------------------
Results in output.txt
where aComputerName is an actual comptuer
Processing aComputerName
---------------------
Results in output.txt
where aComputerName is an actual comptuer
I didn't initially test the code, just wrote it. It amazingly works as posted. I tested at work where SERVER.TXT has two computers in it:
server1
server2
The output showed the ping output.
Did you cut and paste the code above?
Does the processing display any other information to the console when it runs?
What happens if you say this from the command line?
ping aComputerName
Where aComputerName is an actual computer.
server1
server2
The output showed the ping output.
Did you cut and paste the code above?
Does the processing display any other information to the console when it runs?
What happens if you say this from the command line?
ping aComputerName
Where aComputerName is an actual computer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, just answered this question: https://www.experts-exchange.com/questions/22562015/Pinging-multiple-machines-with-text-file-input.html?cid=236&anchorAnswerId=19058712#a19058712
Best of luck,
harperse
Best of luck,
harperse
bbcac, have you looked at any of the Experts possible solutions here?
Rob.
Rob.
server1
server2
server3
Here's batch file that will ping each and save the results to a file named output.txt:
@echo off
setlocal
set serverFile=server.txt
set outFile=output.txt
if not exist "%serverFile%" echo %serverFile% does not exist.&goto :EOF
del "%outFile%" 2>NUL
for /f "tokens=*" %%a in ('type "%serverFile%"') do call :PROCESS "%%a"
echo Results in %outFile%
goto :EOF
:PROCESS
(echo Processing %~1)>>"%outFile%"
(echo ---------------------)>>"%
ping %~1 >>"%outFile%"
goto :EOF
Good Luck,
Steve