[转载]https://www.cnblogs.com/hiwangzi/p/7475121.html
今天启动电脑不知怎么了,网卡突然傻掉了,于是乎我便想找到网络共享中心。可是一顿操作下来速度不尽人意。于是我就突发奇想,看看能不能在cmd上做文章
cmd与网卡(netsh命令)
1.通过命令提示符(cmd)命令连接wifi
1.1连接曾经连接过的wifi
>查看配置的列表
netsh wlan show profile
>连接
netsh wlan connect ssid=你的SSID名字(可以理解为wifi名) name=你的配置的名字
有三个参数
ssid -无线网络的SSID
name -连接尝试所使用的配置文件的名称
interface -尝试连接的接口名称
官方解释
1.2连接从未连接过的wifi
>先增加一项wifi配置,注意要在配置文件所在目录执行
netsh wlan add profile filename="你的配置.xml"
>查看配置的列表,检查是否添加成功
netsh wlan show profile
>连接
netsh wlan connect ssid=你的SSID名字 name=你的配置名字
- 示例配置文件
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>你的配置名字(与SSID名字相同即可)</name>
<SSIDConfig>
<SSID>
<name>你的SSID名字</name>
</SSID>
</SSIDConfig>
<connectionType>ESS</connectionType>
<connectionMode>auto</connectionMode>
<MSM>
<security>
<authEncryption>
<authentication>WPA2PSK</authentication>
<encryption>AES</encryption>
<useOneX>false</useOneX>
</authEncryption>
<sharedKey>
<keyType>passPhrase</keyType>
<protected>false</protected>
<keyMaterial>你的WiFi密码</keyMaterial>
</sharedKey>
</security>
</MSM>
<MacRandomization xmlns="http://www.microsoft.com/networking/WLAN/profile/v3">
<enableRandomization>false</enableRandomization>
</MacRandomization>
</WLANProfile>
查看连接过的wifi密码(实用)
>查看特定
netsh wlan show profile 配置名称 key=clear
>查看所有
>for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profile') do @echo %j |findstr -i -v echo | netsh wlan show profiles %j key = clear
查看,禁用,启用网络接口(网卡)
>查看网络接口的列表
netsh interface show interface
>禁用网络接口
netsh interface set interface 接口名称 disabled
>启用网络接口
netsh interface set interface 接口名称 enabled
欢迎各位提出宝贵意见!