#Windows for /L %i in (1,1,254) do ping -n 1 -w 100 192.168.1.%i | find "回复" >> ping.txt #Linux for i in {1..254};do ping -c1 192.168.3.$i |if [ $(awk '/received/{print $4}') -ne 0 ];then echo 192.168.3.$i >> ping_test.txt; fi;done