netsh(Network Shell) 是一個windows系統本身提供的功能強大的網絡配置命令行工具。 導出配置腳本:netsh -c interface ip dump > c:\interface.txt 導入配置腳本:netsh -f c:\interface.txt。
1.disable、enable網卡
建議將系統的網卡名改成英文名,這樣在輸入命令的時候會很方便。
例如:
第一塊無線網卡可取名為 wlan0
第一塊有線網卡可取名為 eth0,依此類推。
我電腦中的網卡命名如下圖所示:
首先以管理員身份身份運行 cmd 程序
禁用無線網卡:netsh interface set interface wlan0 disabled
啟用無線網卡:netsh interface set interface wlan0 enabled
禁用有線網卡:netsh interface set interface eth0 disabled
啟用有線網卡:netsh interface set interface eth0 enabled
2.更改IP相關
2.1、修改IP地址addr和子網掩碼mask:
>netsh interface ip set address name="本地連接" source=static addr=192.168.0.106 mask=255.255.255.0
2.2、修改默認網關gateway
>netsh interface ip set address name="本地連接" gateway=192.168.0.1 gwmetric=0
2.3、修改首選(PRIMARY)的DNS
>netsh interface ip set dns name="本地連接" source=static addr=202.96.128.66 register=PRIMARY
3.連接無線網絡
http://www.360doc.com/content/13/0215/15/6764271_265756941.shtml