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