给您我上次作的东西,请自己再修改吧。
#include <array.au3>
#include <GUIConstantsEx.au3>
;~ get netadaptname
Local $oClassSet, $oClass, $oLocator
Local $oService, $sMesStr
$oLocator = ObjCreate("WbemScripting.SWbemLocator")
$oService = $oLocator.ConnectServer
$oClassSet = $oService.ExecQuery("Select * From Win32_NetworkAdapter Where NetConnectionID IS NOT NULL")
For $oClass In $oClassSet
$sMesStr = $sMesStr & "" & $oClass.NetConnectionID
$CardName = StringRegExp($sMesStr,"區域連線.+\d",3)
Next
;~ gui
$newIp = InputBox("IP","請輸入IP","10.1.")
If @error Then Exit
$newSubnet = "255.255.255.0"
$newDG = InputBox("Gateway","請輸入Gateway","10.1.")
If @error Then Exit
$run=runwait ('netsh interface ip set address name=' & '"' & $CardName[0] & '" static ' & $newIP & ' '& $newSubnet & ' ' & $newDG & ' 1',"",@SW_Hide)
MsgBox(4096,"修改IP","已完成")
|