Running mac.bat will generate the local MAC information into a c:\addmac.htm and run it. Using the automatic jump of this file, the MAC is submitted to mac.php for processing via GET!
It has been tested and works in win2003\xp\2000! But the c:\addmac.htm generated in win98 cannot save the MAC information
Please take a look at what the problem is!
:::mac.bat::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo
:::::::::If c:\ipconfig.txt exists, delete it
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::Run ipconfig /all command and save its content to ipconfig.txt
ipconfig /all >c:\ipconfig.txt
:::::::::If c:\MyMAC.txt exists, delete it
if exist c:\MyMAC.txt del c:\MyMAC.txt
:::::::::Query the line containing Physical Address in c:\ipconfig.txt and save this line to c:\MyMAC.txt
find "Physical Address" c:\ipconfig.txt >c:\MyMAC.txt
:::::::::If c:\addmac.htm exists, delete it
if exist c:\addmac.htm del c:\addmac.htm
::@echo <meta http-equiv="refresh" content="1;URL=http://192.168.1.1/mac.php?macinfo=">
echo "<meta http-equiv='refresh' content='1;URL=http://localhost:8080/mac/addmac.php?macinfo=" >>c:\addmac.htm
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1* delims=:" %%a in (c:\MyMAC.txt) do (
set c=%%b
if not defined a (<nul set/p pp=!c:~1,17!>>c:\addmac.htm&set a=1) else (<nul set/p pp=!pp!^|!c:~1,17!>>c:\addmac.htm)
)
echo "'>" >>c:\addmac.htm
start "" c:\addmac.htm
:::::::::If c:\ipconfig.txt exists, delete it
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::If c:\MyMAC.txt exists, delete it
if exist c:\MyMAC.txt del c:\MyMAC.txt
exit
::End::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
It has been tested and works in win2003\xp\2000! But the c:\addmac.htm generated in win98 cannot save the MAC information
Please take a look at what the problem is!
:::mac.bat::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo
:::::::::If c:\ipconfig.txt exists, delete it
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::Run ipconfig /all command and save its content to ipconfig.txt
ipconfig /all >c:\ipconfig.txt
:::::::::If c:\MyMAC.txt exists, delete it
if exist c:\MyMAC.txt del c:\MyMAC.txt
:::::::::Query the line containing Physical Address in c:\ipconfig.txt and save this line to c:\MyMAC.txt
find "Physical Address" c:\ipconfig.txt >c:\MyMAC.txt
:::::::::If c:\addmac.htm exists, delete it
if exist c:\addmac.htm del c:\addmac.htm
::@echo <meta http-equiv="refresh" content="1;URL=http://192.168.1.1/mac.php?macinfo=">
echo "<meta http-equiv='refresh' content='1;URL=http://localhost:8080/mac/addmac.php?macinfo=" >>c:\addmac.htm
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1* delims=:" %%a in (c:\MyMAC.txt) do (
set c=%%b
if not defined a (<nul set/p pp=!c:~1,17!>>c:\addmac.htm&set a=1) else (<nul set/p pp=!pp!^|!c:~1,17!>>c:\addmac.htm)
)
echo "'>" >>c:\addmac.htm
start "" c:\addmac.htm
:::::::::If c:\ipconfig.txt exists, delete it
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::If c:\MyMAC.txt exists, delete it
if exist c:\MyMAC.txt del c:\MyMAC.txt
exit
::End::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

