1、将下面的代码复制为一个BAT文件,加入启动组即可!文件名最好不要为ARP.BAT,防止被杀软干掉!
echo off
:::::::::读取本机Mac地址
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist phyaddr.txt del phyaddr.txt
find "Physical Address" ipconfig.txt >phyaddr.txt
for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set Mac=%%M
:::::::::读取本机ip地址
if exist IPAddr.txt del IPaddr.txt
find "IP Address" ipconfig.txt >IPAddr.txt
for /f "skip=2 tokens=15" %%I in (IPAddr.txt) do set IP=%%I
:::::::::绑定本机IP地址和MAC地址
arp -s %IP% %Mac%
:::::::::读取网关地址
if exist GateIP.txt del GateIP.txt
find "Default Gateway" ipconfig.txt >GateIP.txt
for /f "skip=2 tokens=13" %%G in (GateIP.txt) do set GateIP=%%G
:::::::::读取网关Mac地址
if exist GateMac.txt del GateMac.txt
arp -a %GateIP% >GateMac.txt
for /f "skip=3 tokens=2" %%H in (GateMac.txt) do set GateMac=%%H
:::::::::绑定网关Mac和IP
arp -s %GateIP% %GateMac%
del GateIP.TXT /Q
DEL GateMac.txt /q
del IPAddr.txt /q
del ipconfig.txt /q
del phyaddr.txt /q
exit
2、要想让系统启动时不出现BAT文件运行时的黑框(一闪即过)可以编一个VBS文件调用BAT文件,使
运行BAT文件时不显示命令窗口。
新建一个记事本文件,保存为abc.vbs,在文件中加入如下代码:
Set shell = Wscript.createobject("wscript.shell")
a = shell.run ("BAT文件所在文件夹\要运行的BAT文件.bat",0)将这个VBS文件加入启动组就没有一
闪即过的黑框了!!这是一个网上的文章,我看了后认为没有多大的意义。因为只要IP与MAC相绑就可
本机以及网关IP和MAC地址绑定批处理程序P.M.@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 本机以及网关IP和MAC地址绑定批处理程序 ::
:: 说明:此方法治标不治本,要想根本解决ARP请 ::
:: 采用路由和本机实现双向绑定, ::
::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::读取本机Mac地址
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist phyaddr.txt del phyaddr.txt
find "Physical Address" ipconfig.txt >phyaddr.txt
for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set Mac=%%M
:::::::::读取本机ip地址
if exist IPAddr.txt del IPaddr.txt
find "IP Address" ipconfig.txt >IPAddr.txt
for /f "skip=2 tokens=15" %%I in (IPAddr.txt) do set IP=%%I
:::::::::绑定本机IP地址和MAC地址
arp -s %IP% %Mac%
:::::::::读取网关地址
if exist GateIP.txt del GateIP.txt
find "Default Gateway" ipconfig.txt >GateIP.txt
for /f "skip=2 tokens=13" %%G in (GateIP.txt) do set GateIP=%%G
:::::::::读取网关Mac地址
if exist GateMac.txt del GateMac.txt
arp -a %GateIP% >GateMac.txt
for /f "skip=3 tokens=2" %%H in (GateMac.txt) do set GateMac=%%H
:::::::::绑定网关Mac和IP 这里一定要改成你自己的网关MAC地址要不上不了网的
arp -s 192.168.1.252 00-0A-EB-D5-E4-4A
del GateIP.txt
del gatemac.txt
del ipaddr.txt
del ipconfig.txt
del phyaddr.txt
exit