找回密码
 加入
搜索
查看: 967|回复: 1

IniRead的问题

[复制链接]
发表于 2009-10-25 20:30:08 | 显示全部楼层 |阅读模式
本帖最后由 landays 于 2009-10-25 21:11 编辑

源码:
$MyMac = mac()
MsgBox (64,"",$MyMac)
$RepWr = StringReplace ($MyMac,":","-")
MsgBox (64,"",$RepWr)
$Cfg = @ScriptDir & "\eGoIP.ini"
$eGoIP = IniRead ($Cfg,"MACLIST",$RepWr,"")
MsgBox (64,"",$eGoIP)
;读取Mac
Func mac()
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled != 0", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
   For $objItem In $colItems
      $Output1 = $Output & "" & $objItem.MACAddress & @CRLF
   Next
Return $Output1
Else
Endif
EndFunc
配置文件:eGoIP.ini
[MACLIST]
00-E0-4D-3B-55-DC=A001,192.168.0.11

mac()读取出的MAC与配置文件里的一样
但是为何读不出结果?
 楼主| 发表于 2009-10-25 21:10:47 | 显示全部楼层
自己解决了。
删除字符串的空格即可
可奇怪的是直接输出变量到文本文档里,没发现有空格
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-18 14:42 , Processed in 0.069967 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表