windows下局域网内循环ping设备的脚本(ip地址从192.168.1.1~192.168.1.255)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_39568531/article/details/79802906

有时候会碰到这样的情况,一台设备可以联网,但是你无法获知其ip地址,该怎么办。下面通过脚本循环执行ping指令的方法可以帮你找到答案。

创建一个ping.bat的文件,在文件中写入以下命令:

   @Echo off
    date /t >> IPList.txt
  time /t >> IPList.txt
  echo =========== >> IPList.txt
  for /L %%I in (1,1,255) do (%SystemRoot%\System32\PING.EXE -n 1 192.168.1.%%I )
    @Find "Request timed out." & echo 192.168.0.%%I Timed Out >>IPList.txt & echo off
    pause  
	
  cls
  Echo Finished!
  @Echo on
  Notepad.exe IPList.txt

猜你喜欢

转载自blog.csdn.net/weixin_39568531/article/details/79802906