Ping all addresses in network, windows

前端 未结 11 1521
庸人自扰
庸人自扰 2021-01-30 00:14

Is it possible in windows cmd line to check all of the network addresses (with ping or similar) to see which ones are taken/ have active devices:

ie. something that does

11条回答
  •  一个人的身影
    2021-01-30 00:34

    Open the Command Prompt and type in the following:

    FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt
    

    Change 192.168.10 to match you own network.

    By using -n 1 you are asking for only 1 packet to be sent to each computer instead of the usual 4 packets.

    The above command will ping all IP Addresses on the 192.168.10.0 network and create a text document in the C:\ drive called ipaddresses.txt. This text document should only contain IP Addresses that replied to the ping request.

    Although it will take quite a bit longer to complete, you can also resolve the IP Addresses to HOST names by simply adding -a to the ping command.

    FOR /L %i IN (1,1,254) DO ping -a -n 1 192.168.10.%i | FIND /i "Reply">>c:\ipaddresses.txt
    

    This is from Here

    Hope this helps

提交回复
热议问题