自动获取IP及DNS:
netsh interface ip set address name="本地连接" source=dhcp
netsh interface ip set dnsservers name="本地连接" source=dhcp
设置静态IP及DNS:
netsh interface ip set address name="本地连接" static 192.168.1.96 255.255.255.0 192.168.1.1
netsh interface ip set dnsservers name="本地连接" static 192.168.1.1
注意:
运行时需要提升管理员权限