;以下代码可以解决了,谢谢!;获取网卡名称
Dim $objwmiservice = ObjGet('winmgmts:\\localhost\root\CIMV2'), $netsh
$colitems = $objwmiservice.ExecQuery('SELECT * FROM Win32_NetworkAdapter', 'WQL', 0x10 + 0x20)
If IsObj($colitems) Then
For $objitem In $colitems
If $objitem.netconnectionid <> '' Then
$netsh = $objitem.netconnectionid
EndIf
Next
EndIf
;修改IP
GUICtrlSetData($Edit4_1, "2、修改IP地址为: " & $sdip & @CRLF, "1")
Sleep(500)
GUICtrlSetData($Edit4_1, "3、修改子网掩码为: " & $mask & @CRLF, "1")
Sleep(500)
GUICtrlSetData($Edit4_1, "4、修改网关为: " & $gateway & @CRLF, "1")
RunWait('netsh interface ip set address name = "' & $netsh & '" source = static addr = ' & $sdip & ' mask = ' & $mask & ' gateway = ' & $gateway & ' gwmetric = 0', "c:\windows\system32", @SW_HIDE)
GUICtrlSetData($Edit4_1, "5、修改DNS1为: " & $Dns[1] & @CRLF, "1")
RunWait('netsh interface ip set dns name = "' & $netsh & '" source = static addr = ' & $Dns[1] & ' register = PRIMARY', "c:\windows\system32", @SW_HIDE)
GUICtrlSetData($Edit4_1, "6、修改DNS2为: " & $Dns[2] & @CRLF, "1")
RunWait('netsh interface ip add dns name = "' & $netsh & '" addr = ' & $Dns[2] & ' index=2', "c:\windows\system32", @SW_HIDE)
|