源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

CMD和vbs修改 IP地址及DNS的实现代码

  • 时间:2020-02-10 00:14 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:CMD和vbs修改 IP地址及DNS的实现代码
[b]修改IP[/b] cmd /c netsh interface ip set address name=" 本地连接" source=static addr=211.82.56.253 mask=255.255.255.0 gateway=211.82.56.1 gwmetric=1 [b]修改DNS[/b] cmd /c netsh interface ip set dns name="本地连接" source=static addr=202.99.192.66 [b]配置或更新IP地址:[/b] wmic nicconfig where index=0 call enablestatic("192.168.1.5"), ("255.255.255.0") ;index=0说明是配置网络接口1。 [b]配置网关(默认路由):[/b] wmic nicconfig where index=0 call setgateways("192.168.1.1"),(1) [b]vbs [/b] Const T_GATEWAY = "211.82.56.1" '网关 Const T_NEWDNS1 = "202.99.192.66" 'DNS1 Const T_NEWDNS2 = "60.221.248.43" 'DNS2 strWinMgmt="winmgmts:{impersonationLevel=impersonate}" Set NICS = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration") For Each NIC In NICS If NIC.IPEnabled Then NIC.SetDNSServerSearchOrder Array(T_NEWDNS1,T_NEWDNS2) NIC.SetGateways Array(T_GATEWAY) End If Next
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部