您当前的位置是:首页-DOS知识

批处理实现发送网络消息

【发表于】:2010/11/20 23:02:00  已被访问:147次

@echo off
set /a ip0 = 192
set /a ip1 = 168
set /a ip2 = 1
set /a ip3 = 1

:ping
ping %ip0%.%ip1%.%ip2%.%ip3% -n 1 -w 1 | find "TTL" >>tmp1.txt
set /a ip3 = %ip3% + 1
if not %ip3% == 255 goto ping

for /f "eol=: tokens=3" %%i in (tmp1.txt) do echo %%i >>tmp2.txt
if exist ip.txt echo y | del ip.txt
for /f "delims=:" %%i in (tmp2.txt) do echo %%i >>ip.txt
for /f %%i in (ip.txt) do net send %%i "你好!"

echo y | del tmp1.txt & echo y | del tmp2.txt

 
上下篇: 批处理实现网络扫描 打印机每天都要重新连接

最新推荐信息