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

源码网商城

用vbs实现配置静态 IP 地址

  • 时间:2020-10-18 23:41 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:用vbs实现配置静态 IP 地址
将计算机的 IP 地址设置为 192.168.1.141,并将 IP 网关设置为 192.168.1.100。 脚本代码
[u]复制代码[/u] 代码如下:
strComputer = "."  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")  Set colNetAdapters = objWMIService.ExecQuery _      ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")  strIPAddress = Array("192.168.1.141")  strSubnetMask = Array("255.255.255.0")  strGateway = Array("192.168.1.100")  strGatewayMetric = Array(1)  For Each objNetAdapter in colNetAdapters      errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)      errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)      If errEnable = 0 Then          WScript.Echo "The IP address has been changed."      Else          WScript.Echo "The IP address could not be changed."      End If  Next 
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部