如下是我前期写的- @echo off&&setlocal enabledelayedexpansion
- title 快速获取局域网在线电脑的主机名ip地址及Mac地址
- echo 本工具需要sed.exe支持
- del /q IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html>nul 2>nul
- del /q *.ini>nul 2>nul
- arp -d
- net view>>test.ini
- findstr /i "\\" test.ini>>3.ini
-
- set p=0
- echo %date%%time%结果>IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html>nul 2>nul
- for /f %%i in (3.ini) do (
- set /a p+=1
- echo.>>IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html
- set ww=%%i
- set "ww=!ww:~2,20!"
- set "ww=!ww: =!"
- echo %%i
- echo ^<p^>第!p!台主机--》>>IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html
- ping -n 1 !ww!|findstr /i "pinging">>IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html || echo ^<font color^=blue^>!ww! ping 不通^</font^>>>IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html
- nbtstat -a !ww!|findstr /ic:"MAC Address">>IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html
- )
- echo 在线电脑共!p!台,任务结束!
- del /q *.ini>nul
- sed -i "s/Pinging/<b>/g;s/\] with 32 bytes of data://g;s/ Address = /地址 /g;s/\[/<\/b>的IP地址 /g" IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html
- chcp 936>nul
- start IP电脑名MAC%date:~0,4%%date:~5,2%%date:~8,2%.html
- ping /n 7 127.1>nul
复制代码 用到的sed在首页左下角。忙,顾不上给链接了。 |