![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-02 14:14 |
共 48,038 主题排行 / 350,123 发帖 / 今日 1 篇 / 48,251 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 构思获取MAC的批处理出现的问题! |
| 可打印版本 857 / 1 |
| 第1楼 fbi | 发表于 2006-11-30 22:31 |
| 新手上路 发帖 8 积分 15 | |
|
构思获取MAC的批处理出现的问题! 构思获取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 请大侠帮忙完成余下的问题吧! 谢谢! |
|
| 第2楼 9527 | 发表于 2006-12-01 02:10 |
| 银牌会员 发帖 438 积分 1,185 来自 北京 | |
|
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1* delims=:" %%a in (tmp.txt) do ( set c=%%b if not defined a (<nul set/p pp=!c:~1,17!>>oo.txt&set a=1) else (<nul set/p pp=!pp!^|!c:~1,17!>>oo.txt) ) start "" oo.txt |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |