#include <Constants.au3>
$ip1 = @IPAddress1
Dim $SetIPAddress
$SetIPAddress = $ip1
$SetIPAddress = "192.168.1.199"
$foo = Run(@SystemDir&"\ipconfig.exe", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($foo)
$text=StdoutRead($foo)
$text=StringTrimLeft($text, StringInStr($text, "Subnet Mask")+35)
$text=StringLeft($text, StringInStr($text, " ")-4)
if StringLen($text) < 8 then $text = "255.255.255.0"
Dim $SetSubnetmask
$SetSubnetmask = $text
$SetSubnetmask = "255.255.255.0"
$objWMIService = ObjGet("winmgmts:\\" & "." & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
$colComputers = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
If IsObj($colItems) Then
For $objNetAdapter In $colItems
$objNetAdapter.EnableStatic($SetIPAddress, $SetSubnetmask)
Next
EndIf
runwait(@ComSpec&" /c ipconfig&pause")
Dim $SetIPAddress
$SetIPAddress = $ip1
Dim $SetSubnetmask
$SetSubnetmask = $text
$objWMIService = ObjGet("winmgmts:\\" & "." & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
$colComputers = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
If IsObj($colItems) Then
For $objNetAdapter In $colItems
$objNetAdapter.EnableStatic($SetIPAddress, $SetSubnetmask)
Next
EndIf
runwait(@ComSpec&" /c ipconfig&pause")
谢谢 你正是及时雨
收下学习!!!! 还漏了网关哈
页:
1
[2]