|
本帖最后由 rdw167 于 2014-5-24 19:07 编辑
1,这是,读取ini配置文件的 自动修改mac地址的, #Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Outfile=au3\macccc.exe
#PRE_UseUpx=n
#PRE_UseX64=n
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
;定义常量
$strComputer = "."
$BS_FLAT = 0x8000
$TRAY_EVENT_PRIMARYDOUBLE = -13
$TRAY_DISABLE = 128
$TRAY_ENABLE = 64
;获取网卡名称以及ID
$objWMIService = objGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For $objItem in $colItems
If StringLeft($objItem.MACAddress,2) = 00 Then
;MsgBox (0,"",$objItem.Caption)
$Key = StringMid($objItem.Caption,6,4)
$DriverDesc = $objItem.Description
EndIf
Next
;读取网卡的信息
$Path = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
$Temp1 = RegRead ($Path&$Key , "ComponentId")
$Temp2 = RegRead ($Path&$Key , "MatchingDeviceId")
$Temp3 = RegRead ($Path&$Key,"DriverDesc")
If FileExists (@ScriptDir & "\SET.ini") = 1 Then
$SectionNames1 = IniReadSection(@ScriptDir & "\SET.ini", "ModifiaMAC")
EndIf
If @error OR $SectionNames1[1][1] = "" OR StringLen ($SectionNames1[1][1]) <> 12 OR StringIsAlNum ($SectionNames1[1][1]) <> 1 Then
MsgBox(0, "错误", "发生错误,缺少标准的INI文件.""程序将退出!",5)
Else
$ModifiaMAC = $SectionNames1[1][1]
EndIf
RegDelete ($Path&$Key,"networkaddress")
RegWrite ($Path&$Key,"networkaddress","REG_SZ",$ModifiaMAC)
RunWait (@ComSpec & ' /c devcon find pci\* > "'&@TempDir&'"\Dev.txt',"",@SW_HIDE)
$i = 0
$file = FileOpen(@TempDir&"\Dev.txt", 0)
While 1
$i = $i + 1
$lineWherther = FileReadLine($file)
$Wherther = StringSplit($lineWherther,":")
If StringInStr ( $Wherther[2], $Temp3) Then ExitLoop
Wend
$line = FileReadLine($file,$i)
$Split = StringSplit($Line,"&")
FileClose($file)
RunWait ( "devcon disable *"&$Split[2]&"*","",@SW_HIDE)
RunWait ("devcon enable *"&$Split[2]&"*","",@SW_HIDE)
2,我在set.ini 配置文件添加多个 mac地址列表, 让它延迟30分钟,自动更改一个里列表里面mac地址。
3,最好是能循环循环执行更改的。 谢谢。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|