中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-24 09:49
47,812 topics / 349,917 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » Please provide the batch processing content that needs to be improved so that I can help you translate and improve it.
Printable Version  2,421 / 16
Floor16 flamey Posted 2007-01-01 05:30
初级用户 Posts 74 Credits 152
Found online, I forgot who wrote it because I've been using it for a long time!

@echo off
:::::::::Read the local MAC address
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
:::::::::Read the local IP address
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
:::::::::Bind the local IP address and MAC address
arp -s %IP% %Mac%
:::::::::Read the gateway address
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
:::::::::Read the gateway MAC address
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
:::::::::Bind the gateway MAC and IP
arp -s %GateIP% %GateMac%
exit
Floor17 lovehack2006 Posted 2007-01-03 00:39
初级用户 Posts 64 Credits 135
The guy upstairs, what I'm talking about is this batch processing one, there's a problem with this...
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023