标题: 自动arp清除.bat
[打印本页]
作者: xiaoyong12
时间: 2009-5-13 15:01
标题: 自动arp清除.bat
@echo off&&setlocal enabledelayedexpansion
set name=%~n0
title %name% is made by xiaoyong
if exist %tmp%\ipconfig.txt del %tmp%\ipconfig.txt
ipconfig /all >%tmp%\ipconfig.txt
if exist %tmp%\GateIP.txt del %tmp%\GateIP.txt
find "Default Gateway" %tmp%\ipconfig.txt >%tmp%\GateIP.txt
for /f "skip=2 tokens=13" %%G in (%tmp%\GateIP.txt) do set GateIP=%%G
if exist %tmp%\IPAddr.txt del %tmp%\IPaddr.txt
find "IP Address" %tmp%\ipconfig.txt >%tmp%\IPAddr.txt
for /f "skip=2 tokens=15" %%I in (%tmp%\IPAddr.txt) do set IP=%%I
del %tmp%\ipconfig.txt
del %tmp%\GateIP.txt
del %tmp%\IPAddr.txt
echo *****************************
echo * *
echo * 1.ping GateIP *
echo * *
echo * 2.ping 本机IP *
echo *****************************
set /p choice=请选择(1——2):
if !choice! equ 1 set pin=%GateIP%
if !choice! equ 2 set pin=%IP%
cls
mode con cols=55 lines=4
set count=0
:return
if exist %tmp%\ping.txt del %tmp%\ping.txt
ping -n 2 %pin%>%tmp%\ping.txt&&goto display
:display
for /f "delims= tokens=1-6 skip=3" %%I in (%tmp%\ping.txt) do (
cls
set var=%%I
set/p=!var!<nul
set m=!var:~0,5!
ping -n 1 127.0.0.1>nul&&goto out
)

ut
if not "!m!" == "Reply" goto hello
goto return
:hello
for /l %%a in (1,1,10) do (
arp -d
)
set /a count=count+1
if !count! equ 8 goto IPrestore
goto return
:IPrestore
nbtstat -R
ipconfig /flushdns
nbtstat -RR
ipconfig /registerdns
set /a count=0
goto return
很久以前写的。
附件
1:
自动arp清除.rar (2009-5-13 15:02, 768 bytes,下载次数: 24)
作者: yixiang
时间: 2009-5-15 02:50
貌似很强大哦