linuxAndMcu

一、使用netsh命令设置IP/DNS

(1)自动获取IP地址:

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

(2)手动设置IP地址:例如设置 IP 为 192.168.1.198,掩码为255.255.255.0,网关为192.168.0.254,那么 cmd 命令为:

netsh interface ip set address [name=]"本地连接" [source=]static [addr=]192.168.1.198 [mask=]255.255.255.0 [gateway=]192.168.0.254 [gwmetric=]1
  • name:网络连接名称,一般为“本地连接”。你可以在“控制面板” -> “网络连接”中看到
  • source:获取 IP 的途径。动态获取,则为 dhcp;手动设置,则为 static
  • addr:要设置的 IP 地址
  • mask:要设置的子网掩码
  • gateway:要设置的网关地址
  • gwmetric:网关跃点数,可以设置为整型数值,也可以设置为 auto

二、使用netsh命令连接wifi

(1)显示本机保存的 profiles,配置文件是以 wifi 的 ssid 命名的:

netsh wlan show profiles

(2)然后连接其中一个 profile:

netsh wlan connect name=xxxxx

(3)断开连接

netsh wlan disconnect [[interface=]<string>]

如果系统中有两个或多个可用接口,则参数 interface 是必需的,否则无需指定参数 interface。可以在接口名称中使用通配符字符以便指定多个接口。


三、netsh wlan帮助信息

img


四、其他netsh命令

其它常用的 netsh 命令:

  • 设置配置文件属性:Netsh WLAN set profileparameter name="" connectionmode=manual

  • 列出配置文件:netsh wlan show profile

  • 导出配置文件:netsh wlan export profile key=clear

  • 删除配置文件:netsh wlan delete profile name=""

  • 添加配置文件:netsh wlan add profile filename=""

  • 连接指定wifi:netsh wlan connect name="wifi name"

  • 列出无线接口:netsh wlan show interface

  • 开启无线接口:netsh interface set interface "Interface Name" enabled

  • 禁用无线接口:netsh interface set interface "Interface Name" disable


五、使用netsh命令查看所有连接过的WIFI密码

输入命令:netsh wlan show profiles name="profileName" key=clear,就可以查看到某个具体 WiFi 的配置详情,包括密码。


参考:

微软官方指南:Windows Server 2008中用于无线局域网(WLAN)的Netsh命令

介绍网站:如何在Windows 10中使用命令提示符管理无线网络

利用netsh命令设置IP地址/DNS服务器地址

windows 通过cmd命令(netsh wlan命令)连接wifi


分类:

技术点:

相关文章: