The bat batch automatically pings in batches based on the computer name and gives the ping result (ping or ping is not working)

Source: Internet
Author: User
Tags pings

@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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.