Windows 批處理 ping 某個網段

來源:互聯網
上載者:User

標籤:err   ant   variable   get   art   int   代碼   txt   查看命令   

原文: 51288248

----------------------------------------------------------------

 

  • 如果想知道自己區域網路內或外網任意某一段線上的ip,又或者想要知道目前有多少人同時在上網怎麼辦呢?可能大家想到的一定是找工具什麼的。其實不然,利用Windows內建的批處理功能完全可以實現批量ping尋找指定網段存活主機的目的!往下瞧吧。
@echo offset /p ip="請輸入IP位址區段,格式如:"192.168.1." >>> "for /L %%i in (1,1,254) do (Ping.exe -n 1 -l 16 -w 100 %ip%%%i>>ipscan.txtif not errorlevel 1 (echo %ip%%%i 可以ping通))pause
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 複製以上代碼粘貼到記事本文檔裡,然後另存新檔 ipscan.bat 。然後雙擊一鍵運行 ipscan.bat 批處理指令碼根據提示輸入要掃描的IP段,就可以看到返回的結果了。格式類似於:

請輸入IP位址區段,格式如:”192.168.1.” >>> 192.168.1. 
192.168.1.100 可以ping通 
192.168.1.101 可以ping通 
192.168.1.102 可以ping通 
192.168.1.103 可以ping通 
192.168.1.104 可以ping通 
192.168.1.123 可以ping通 
192.168.1.144 可以ping通 
192.168.1.146 可以ping通 
192.168.1.149 可以ping通 
192.168.1.150 可以ping通 
請按任意鍵繼續…

    • 大夥能否看懂呢?看不懂滴可以在cmd視窗裡輸入 for /? 查看命令詳解或網上搜尋學習。##

Windows 批處理 ping 某個網段

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.