#RequireAdmin
#include <Array.au3>
$array = _GetMACAddress()
_ArrayDisplay($array)
Func _GetMACAddress()
Dim $array[5][2]
Dim $i=0
Local $wbemFlagReturnImmediately = 0x10
Local $wbemFlagForwardOnly = 0x20
Local $strComputer = "localhost"
Local $objWMIService,$colItems,$ret[2]
$objWMIService = ObjGet("winmgmts:\" & $strComputer& "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_NetworkAdapter")
For $colItem In $colItems
If $colItem.NetConnectionStatus = 2 Then
$ret[$i][0] = $colItem.MACAddress
$ret[$i][1] = $colItem.Name
$i=$i+1
EndIf
Next
Return $ret
EndFunc
>运行:(3.3.6.1):E:\Program Files\autoit3\autoit3.exe "E:\Program Files\autoit3\SciTe\自动获取MAC\test3.au3"
E:\Program Files\autoit3\SciTe\????MAC\test3.au3 (22) : ==> ?????????????.:
$ret[$i] = 1
^ ERROR
->01:11:01 AutoIT3.exe 完成:[CODE]:1
+>01:11:02 ACNWrapper 完成..
>退出代码: 1 时间: 3.835 |