中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-03 01:00
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 帮我改进一下这个批处理!!! 查看 2,104 回复 16
16 发表于 2007-01-01 05:30 ·  中国 广东 肇庆 电信
初级用户
★★
积分 152
发帖 74
注册 2005-12-01 23:06
20年会员
UID 46314
状态 离线
在网上找到的,是谁编写忘了,因为用的时间比较长了!


@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%
exit
17 发表于 2007-01-03 00:39 ·  中国 广东 深圳 电信
初级用户
★★
积分 135
发帖 64
注册 2006-12-20 04:35
19年会员
UID 74003
性别 男
状态 离线
楼上的哥们,我说的就是这个批处理的,这个有问题。。。。
论坛跳转: