正文

网吧电信网通转换代码2006-09-10 22:20:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/stef/18436.html

分享到:

网吧电信网通转换代码 切换到电信Sub Setip(strgw,strgwMetric,strdns)    Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2")    Set colNetAdapters = objWMIService.ExecQuery _    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")   For Each objNetAdapter in colNetAdapters    errGateways = objNetAdapter.SetGateways(strgw, strgwmetric)    errSetDNS = objNetAdapter.SetDNSServerSearchOrder(strdns)    If errGateways = 0 Then       Else        WScript.Echo "更改失败,"& errGateways    End If   NextEnd Sub gw="192.168.0.1"  '网关fdns="219.146.0.130"  '主dnssdns="202.102.128.68"  '备dns sgw = Array(gw)sgwMetric = Array(1)stdns=Array(fdns,sdns) myvar=MsgBox("请先确认不在游戏中,否则会造成你的游戏中断!"&vbCrLf&"按确定进行切换,按取消退出", 65, "警告")if myvar=vbok thenSetip sgw,sgwMetric,stdnsend if切换到网通Sub Setip(strgw,strgwMetric,strdns)    Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2")    Set colNetAdapters = objWMIService.ExecQuery _    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")   For Each objNetAdapter in colNetAdapters    errGateways = objNetAdapter.SetGateways(strgw, strgwmetric)    errSetDNS = objNetAdapter.SetDNSServerSearchOrder(strdns)    If errGateways = 0 Then       Else        WScript.Echo "更改失败,"& errGateways    End If   NextEnd Sub gw="192.168.0.101"  '网关fdns="202.102.128.68"  '主dnssdns="219.146.0.130"  '备dns sgw = Array(gw)sgwMetric = Array(1)stdns=Array(fdns,sdns) myvar=MsgBox("请先确认不在游戏中,否则会造成你的游戏中断!"&vbCrLf&"按确定进行切换,按取消退出", 65, "警告")if myvar=vbok thenSetip sgw,sgwMetric,stdnsend if 

阅读(3854) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册