构思获取MAC的批处理待处理的问题!
目的:
利用DOS中的ipconfig获取MAC信息,生成一个自动跳转带MAC信息参数的.htm文件,利用这个文件把这台主机的MAC添加到服务器!
GoMAC.bat内容为:
*****************************************************
@echo off
:::::::::如果c:\macinfo.htm存在就把它删除
::if exist c:\macinfo.htm del c:\macinfo.htm
:::::::::如果c:\ipconfig.txt存在就把它删除
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::运行ipconfig /all命令并把其内容保存到ipconfig.txt
ipconfig /all >c:\ipconfig.txt
:::::::::如果c:\MyMAC.txt存在就把它删除
if exist c:\MyMAC.txt del c:\MyMAC.txt
:::::::::查询c:\ipconfig.txt中含有Physical Address一行,并把这行保存到c:\MyMAC.txt
find "Physical Address" c:\ipconfig.txt >c:\MyMAC.txt
::?????????待处理的问题在这一步?????????????????????????
:::::::::如果c:\ipconfig.txt存在就把它删除
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::如果c:\macinfo.htm存在就把它打开
if exist c:\ipconfig.txt call c:\macinfo.htm
exit
**************************************************
其中待处理的问题是:
生成的c:\MyMAC.txt内容为:
***********************************************
---------- C:\IPCONFIG.TXT
Physical Address. . . . . . . . . : 00-13-3F-6A-54-0B
Physical Address. . . . . . . . . : 00-13-CA-1B-B8-50
Physical Address. . . . . . . . . : 00-53-45-00-00-00
***********************************************
1\我要把c:\MyMAC.txt内容处理为:
00-13-3F-6A-54-0B|00-13-CA-1B-B8-50|00-53-45-00-00-00
2\生成一个文件macinfo.htm的文件,其内容为:
<meta http-equiv="refresh" content="0;url=http://192.168.1.1/macinfo.php?macinfo=00-13-3F-6A-54-0B|00-13-CA-1B-B8-50|00-53-45-00-00-00
3\打开macinfo.htm
请大侠帮忙完成余下的问题吧!
谢谢!
目的:
利用DOS中的ipconfig获取MAC信息,生成一个自动跳转带MAC信息参数的.htm文件,利用这个文件把这台主机的MAC添加到服务器!
GoMAC.bat内容为:
*****************************************************
@echo off
:::::::::如果c:\macinfo.htm存在就把它删除
::if exist c:\macinfo.htm del c:\macinfo.htm
:::::::::如果c:\ipconfig.txt存在就把它删除
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::运行ipconfig /all命令并把其内容保存到ipconfig.txt
ipconfig /all >c:\ipconfig.txt
:::::::::如果c:\MyMAC.txt存在就把它删除
if exist c:\MyMAC.txt del c:\MyMAC.txt
:::::::::查询c:\ipconfig.txt中含有Physical Address一行,并把这行保存到c:\MyMAC.txt
find "Physical Address" c:\ipconfig.txt >c:\MyMAC.txt
::?????????待处理的问题在这一步?????????????????????????
:::::::::如果c:\ipconfig.txt存在就把它删除
if exist c:\ipconfig.txt del c:\ipconfig.txt
:::::::::如果c:\macinfo.htm存在就把它打开
if exist c:\ipconfig.txt call c:\macinfo.htm
exit
**************************************************
其中待处理的问题是:
生成的c:\MyMAC.txt内容为:
***********************************************
---------- C:\IPCONFIG.TXT
Physical Address. . . . . . . . . : 00-13-3F-6A-54-0B
Physical Address. . . . . . . . . : 00-13-CA-1B-B8-50
Physical Address. . . . . . . . . : 00-53-45-00-00-00
***********************************************
1\我要把c:\MyMAC.txt内容处理为:
00-13-3F-6A-54-0B|00-13-CA-1B-B8-50|00-53-45-00-00-00
2\生成一个文件macinfo.htm的文件,其内容为:
<meta http-equiv="refresh" content="0;url=http://192.168.1.1/macinfo.php?macinfo=00-13-3F-6A-54-0B|00-13-CA-1B-B8-50|00-53-45-00-00-00
3\打开macinfo.htm
请大侠帮忙完成余下的问题吧!
谢谢!
