| @echo off set "mainip=45.204.82.82" rem mainip为主IP set "netmask=255.255.255.0" rem netmask为主IP对应的子网掩码 set "gateway=45.204.82.254" rem gateway为主IP对应的网关 set "dns1=223.5.5.5" set "dns2=14.114.114.114" rem 上面的2个DNS一般的需要修改,也可以将DNS2修改为8.8.8.8 for /f "tokens=*" %%i in ('wmic nic where "NetConnectionStatus='2'" get NetConnectionID /value^|find "="') do set %%i set "NetConnectionID=%NetConnectionID%" for /f "tokens=*" %%i in ('wmic nic where "NetConnectionID='%NetConnectionID%'" get index /value^|find "="') do set %%i set "index=%index%" wmic nicconfig where index="%index%" call enablestatic("%mainip%"),("%netmask%") wmic nicconfig where index="%index%" call setgateways("%gateway%"),(1) wmic nicconfig where index="%index%" call SetDNSServerSearchOrder("%dns1%","%dns2%") wmic nicconfig where index="%index%" call SetTcpipNetbios 2 echo 请注意修改下面IP列表 set "netmask2=255.255.255.0" rem netmask2为批量增加IP的子网掩码,而且下列IP的子网掩码均相同 for %%i in ( 154.212.144.97 154.212.144.101 45.204.82.103 45.204.82.154 45.204.82.159 45.204.82.207 45.204.82.215 45.204.82.224 45.204.82.232 45.204.82.233 45.204.82.243 ) do netsh interface ip add address "%NetConnectionID%" %%i "%netmask2%" && echo 添加IP%%i成功 pause exit |
文章来源:
网络小编D
版权声明:
本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请联系本站立刻删除。
