给局域网中所有的计算机发送消息
打开记事本输入:
@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
完毕后保存为 网络消息.bat 并双击运行。运行完毕后会产生一个名为ip.txt的记录文件,里面记录了所发送过消息的电脑的IP地址。
打开记事本输入:
@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
完毕后保存为 网络消息.bat 并双击运行。运行完毕后会产生一个名为ip.txt的记录文件,里面记录了所发送过消息的电脑的IP地址。