如果只有一个网卡- rem 另存为 ANSI 编码 bat
- ' & cls & cscript.exe /nologo /e:vbscript "%~f0" %* & pause & exit /b
-
- DefaultIPGateway = Array("192.168.0.254") '网关
-
- Set oWMI = GetObject("Winmgmts:\\.\Root\CIMV2")
- s = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"
- For Each i In oWMI.ExecQuery(s)
- i.SetGateways DefaultIPGateway
- Next
复制代码
|