自动获取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
注意:
运行时需要提升管理员权限
时间: 2024-11-24 19:01:17