北京燃气查询电话:在DOS行下设置静态IP

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/08 15:03:10
A.设置静态IP
CMD
netsh
netsh>int
interface>ip
interface ip>set add "本地链接" static IP地址 mask gateway
B.查看IP设置
interface ip>show address
请问到这句话该怎么设置 "interface ip>set add "本地链接" static IP地址 mask gateway"

set address static 10.0.0.9 255.0.0.0 10.0.0.1
set address 静态 ip地址 子网掩码 网关

用脚本
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each objNetAdapter In colNetAdapters
sip = objNetAdapter.IPAddress
strIPAddress = Array(IpAdd) '保持原来的ip,如果需要修改ip为192.168.0.200:strIPAddress = Array("192.168.0.200")
strSubnetMask = Array(Mask)
strGateway = Array(GateWay) '修改网关为192.168.0.254
strGatewaymetric = Array(1)

errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
MsgBox "The IP address has been changed."
Else
MsgBox "The IP address could not be changed."
End If
Exit For '只修改第一个网卡的设置
Next