windows 一键设置ip地址脚本

设置为192.168.1.100

@echo off
title 192.168.1.100
color 03
mode con cols=40 lines=15
:: todo
netsh interface ip set address name="network" source="static" addr="192.168.1.100" mask="255.255.255.0" gateway="192.168.1.1" gwmetric="1" 
netsh interface ip set dnsservers "network" static 223.5.5.5 primary validate=no   
netsh interface ip add dnsservers "network" 8.8.8.8 index=2 validate=no   

设置为DHCP

@echo off
title dhcp
color 03
mode con cols=40 lines=15
:: todo
netsh interface ip set address name="network" source="dhcp"
netsh interface ip set dns name="network" source="dhcp"

你可能感兴趣的:(shell)