网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 CMD和vbs修改 IP地址及DNS的实现代码
内容
    命令行下对IP地址及DNS的操作 包括netsh和wmic两个版本 和vbs下对网关和DNS的修改
    修改IP
    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
    修改DNS
    cmd /c netsh interface ip set dns name="本地连接" source=static addr=202.99.192.66
    配置或更新IP地址:
    wmic nicconfig where index=0 call enablestatic("192.168.1.5"), ("255.255.255.0") ;index=0说明是配置网络接口1。
    配置网关(默认路由):
    wmic nicconfig where index=0 call setgateways("192.168.1.1"),(1)
    vbs
    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
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/17 23:44:14