How to connect to a Wireless WIFI Network from the Command line in Windows 7
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?"
The answer, is, ahem, thusly:
C:\>netsh wlan connect name=HANSELMAN-N
Connection request was completed successfully.
Cool.
More Details
What happened there? Well, the command line is netsh wlan and the full one is
netsh wlan connect ssid=YOURSSID name=PROFILENAME
What's a profile? It's the only thing required. You can see them with:
C:\>netsh wlan show profile
Profiles on interface Wireless Network Connection:
...snip..
User profiles
-------------
All User Profile : Clear Spot b0e
All User Profile : HANSELMAN-N
All User Profile : Quiznos
These are the same ones that you see in the wireless networks dialog...
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"
And of course, you can
netsh wlan disconnect
And include the interface optionally, for multiple interfaces. Additionally, interesting things can be seen with
netsh wlan dump
This is nice because you can
netsh wlan dump > myconfig.txt
on one machine and then later on another machine
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.
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.
About Newsletter
You can also scan available wifi from netsh:
> netsh wlan show newtworks
-or-
> netsh wlan show networks mode=bssid
The latter option gives more detail including signal but (doh!) in some arbitrary percentage not in dBm.
On a related note, I was shocked to hear Leo and friends on MacBreak Weekly actually laugh about this McDonalds card about how much easier it is to connect to WiFi with a Mac.
Here is what i found (I may be totally wrong - i know a lot of much more knowledgeable people read and post here than me ;-)
this is for connecting to wireless connections you already have set up.. exactly as Scott is saying this is for profiles that already exist.
I deleted the settings for my wifi and then i played around with the help on netsh and long story short it seems like you need something like:
netsh wlan add profile filename="<xml file of config>" interface="wilress Network Interface" User="username"
dunno the format of the xml file..
more info:
http://technet.microsoft.com/en-us/library/cc755301(WS.10).aspx#bkmk_wlanAddProfile
So not so easy or am i totally wrong?
<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>Gordo</name>
<SSIDConfig>
<SSID>
<hex>4723456F</hex>
<name>Gordon</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>true</protected>
<keyMaterial>03t23464265242424523423450000000010660000000100002000000
0CC5FFB0D403BFCF05E3DF424C202898C73E7F3B51E07FCADE900C2A4586972EC000000000E80000000020
00020000000B1D04C43AF0C4AE68BC21A928E4121211BF937FE1F87DD6810C4620605F2860C10000000CE6
18ED134DF169FB47861C14397BB9D40000000A67F0CE51061F5B4DD4D3A88518645A60BB61F8F536524BDD
EE03FC6BADC4DB3EB075E426FE695E7A9CB26F7607D09EC0856D4A0F512209E1D660FCB4BEFF340</keyMaterial>
</sharedKey>
</security>
</MSM>
</WLANProfile>
dunno if you can generate that is some way?
http://msdn.microsoft.com/en-us/library/aa370029(v=VS.85).aspx
I had tried cutting bits out of the old one but that was not happening
it was very easy, then i disconnected the other wifi network i was connected to and up popped the same password box you get when you join any wifi network and BAM I am connected and posting on the hanselmasters site ;-)
<security>
<authEncryption>
<authentication>WPAPSK</authentication>
<encryption>TKIP</encryption>
<useOneX>false</useOneX>
</authEncryption>
</security>
i get the useOneX being false tells it to set up the shared authentication stuffs?
anyways ill stop bloating you comments.. sorry
Comments are closed.