|
发表于 2020-6-9 11:30:01
|
显示全部楼层
'改IP好说
下面这段脚本保存为*.vbs文件,双击执行就可以改了IP、子网掩码和网关。
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")
strIPAddress = Array("192.168.0.12")
strSubnetMask = Array("255.255.255.0")
arrDefaultGateways = Array("192.168.0.1")
arrGatewayCostMetrics = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errEnable = objNetAdapter.SetGateways(arrDefaultGateways, arrGatewayCostMetrics)
Next
WScript.Echo " Static IP address already enabled."
|
|