@echo off
(for/f "tokens=1*"%%a in (ipTable.txt) does (
Ping%%a >nul && echo%%a ok| | Echo%%a Failed
)) >result.txt
Reads the contents of the IpTable.txt, iptable example:
TestComputerName1
TestComputerName2
TestComputerName3
.....
In addition, if there is more than one column in the IpTable.txt, the column and column are separated by a space, the same can be recognized, and only the first column is recognized, for example
TESTCOMPUTERNAME1 column 2 column 3 column 4 ...
TESTCOMPUTERNAME2 column 2 column 3 column 4 ...
TestComputerName3 column 2 column 3 column 4 ...
.....
Save the above code in a. bat format file, place the ipTable.txt with the IP address or machine name in the same directory, execute the Xxx.bat, and the results will be saved to the Result.txt,result.txt example:
TestComputerName1 OK
TestComputerName2 Failed
TestComputerName3 OK
.....
The bat batch automatically pings in batches based on the computer name and gives the ping result (ping or ping is not working)