win10配置的静态/动态IP和 DNS的方法


1.配置静态IP和DNS

netsh interface ip set address name="以太网" source=static addr=192.168.9.145 mask=255.255.255.0 gateway=192.168.9.108
netsh interface ip set dns name="以太网" source=static addr=8.8.8.8 register=primary validate=no

管理员方式运行dos:

 

2.配置动态IP和DNS

netsh interface ip set address name="以太网" source=dhcp
netsh interface ip set dns name="以太网" source=dhcp

 

3.将命令写成脚本文件(iP配置.bat)

echo 1表示修改成静态IP
echo 2表示修改成动态IP

set /p KEY= [您的选择是:]     
::  /p表示将KEY设置为输入行
if %KEY% == 1 goto ONE 
if %KEY% == 2 goto TWO 

:: 设置静态IP
:ONE  
netsh interface ip set address name="以太网" source=static addr=192.168.9.145 mask=255.255.255.0 gateway=192.168.9.108
netsh interface ip set dns name="以太网" source=static addr=8.8.8.8 register=primary validate=no
pause
exit

:: 设置动态IP
:TWO
netsh interface ip set address name="以太网" source=dhcp
netsh interface ip set dns name="以太网" source=dhcp
pause
exit

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM