如何在Windows 7中从命令行连接到无线WIFI网络

For the humorless amongst you who didn't find these Updated for 2011 - McDonald's WiFi Guide with updates for Mac OS X Lion and Windows 7 to be HIGH-LARIOUS, the question was asked, "well, sir, how do you connect to a Wireless WIFI Network from the Command line in Windows 7?"

对于那些没有幽默感的人,他们没有发现这些“ 2011年更新版-麦当劳WiFi指南”,其中Mac OS X Lion和Windows 7的更新是“大问题” 有人问“好,先生,您如何连接到Windows 7中从命令行提供无线WIFI网络?

The answer, is, ahem, thusly:

因此,答案是:

C:\>netsh wlan connect name=HANSELMAN-N
Connection request was completed successfully.

C:\> netsh wlan连接名称= HANSELMAN-N 连接请求已成功完成。

Cool.

凉。

更多细节 (More Details)

What happened there? Well, the command line is netsh wlan and the full one is

那里发生什么了? 好吧,命令行是netsh wlan,完整的是

netsh wlan connect ssid=YOURSSID name=PROFILENAME

netsh wlan connect ssid =您的ID名称= PROFILENAME

What's a profile? It's the only thing required. You can see them with:

什么是个人资料? 这是唯一需要的东西。 您可以通过以下方式看到它们:

C:\>netsh wlan show profile

C:\> netsh wlan显示配置文件

Profiles on interface Wireless Network Connection:
.
..snip.. User profiles
-------------
    All User Profile     : Clear Spot b0e
    All User Profile     : HANSELMAN-N
    All User Profile     : Quiznos

接口无线网络连接上的配置文件: ..snip .. 用户资料------------- 所有用户个人资料:Clear Spot b0e 所有用户个人资料:HANSELMAN-N 所有用户个人资料:Quiznos

These are the same ones that you see in the wireless networks dialog...

这些与您在无线网络对话框中看到的相同...

如何在Windows 7中从命令行连接到无线WIFI网络

You can set these up and refer to them by name from the command line, or a batch file, etc. Nice to do for the places you are regularly.

您可以设置这些文件,并从命令行或批处理文件等中按名称进行引用。很适合经常使用的地方。

If you have multiple wireless cards (What's wrong with you!?) then you have to be more specific:

如果您有多个无线网卡(您怎么了!!),那么您必须更加具体:

netsh wlan connect ssid=YOURSSID name=PROFILENAME interface="WIRELESS NETWORK CONNECTION"

netsh wlan connect ssid =您的ID名称= PROFILENAME interface =“无线网络连接”

And of course, you can

当然,您可以

netsh wlan disconnect

netsh wlan断开连接

And include the interface optionally, for multiple interfaces. Additionally, interesting things can be seen with

并可选地包括该接口,用于多个接口。 此外,有趣的事物可以通过

netsh wlan dump

netsh wlan转储

This is nice because you can

很好,因为您可以

netsh wlan dump > myconfig.txt

netsh wlan转储> myconfig.txt

on one machine and then later on another machine

在一台机器上,然后在另一台机器上

netsh exec myconfig.txt

netsh exec myconfig.txt

All this command line love will work in most versions of Windows, actually, not just 7 AFAIK. There's lots of more detail and docs on managing Wireless Profiles on the Web.

实际上,所有这些命令行功能都可以在大多数Windows版本中运行,而不仅仅是7 AFAIK。 有关在Web上管理无线配置文件的更多详细信息和文档

Enjoy!

请享用!

关于斯科特 (About Scott)

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

斯科特·汉塞尔曼(Scott Hanselman)是前教授,前金融首席架构师,现在是演讲者,顾问,父亲,糖尿病患者和Microsoft员工。 他是一位失败的单口相声漫画家,一个玉米种植者和一本书的作者。

如何在Windows 7中从命令行连接到无线WIFI网络
如何在Windows 7中从命令行连接到无线WIFI网络
如何在Windows 7中从命令行连接到无线WIFI网络
About   关于 Newsletter 时事通讯
Hosting By 主持人
如何在Windows 7中从命令行连接到无线WIFI网络

翻译自: https://www.hanselman.com/blog/how-to-connect-to-a-wireless-wifi-network-from-the-command-line-in-windows-7