IniRead的问题
本帖最后由 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
00-E0-4D-3B-55-DC=A001,192.168.0.11
mac()读取出的MAC与配置文件里的一样
但是为何读不出结果? 自己解决了。
删除字符串的空格即可
可奇怪的是直接输出变量到文本文档里,没发现有空格
页:
[1]