How To Manage A Wireless WiFi Network from the Command Line in Windows 7

Windows 7 has got an intuitive GUI that makes you connect to any kind of Wireless network much easier than before. There is really no valid reason why you need or should use the command line to accomplish something that you can do the same through the GUI, other than, well, being cool. But anyway, let’s see how it works, all through the built-in netsh command.

To Connect

The simple line of command is

C:\>netsh wlan connect name=102nd

Connection request was completed successfully

Replace 102nd with your own profile name, and you are good to go.

A more formal syntax of connecting to a wireless network is something like:

netsh wlan connect ssid=ssidname name=profilename

What is the Catch?

The real catch is the profile. It’s the file stores all the information necessary to get you connected.

To show what profiles are in your system:

C:\>netsh wlan show profile

User profiles
————-
    All User Profile     : 102nd

That is similar to the ones you often see in your wireless network dialog window.

image

You can export the profile through:

C:\>netsh wlan export profile name="102nd"

Interface profile "102nd" is saved in file ".\Wireless Network Connection-102nd.
xml" successfully.

Later on, you can import the same profile to the same or other computers.

C:\>netsh wlan add profile filename="wireless network connection-102nd.xml"

To Disconnect

C:\>netsh wlan disconnect

Disconnection request was completed successfully for interface "Wireless Network
Connection".

To Show More Wireless Info

The show option in Netsh provides many ways to show many information about your wireless network, more than you need in most cases. For example, you can show the complete wireless device and networks information from:

C:\>netsh wlan show all

You can also show the blocked network display settings from:

C:\>netsh wlan show blockednetworks

Or, show a list of network visible on the system:

C:\>netsh wlan show networks

Interface name : Wireless Network Connection
There are 3 networks currently visible.

SSID 1 : 102nd
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP

SSID 2 : cambian
    Network type            : Infrastructure
    Authentication          : Open
    Encryption              : WEP

What’s Interesting?

You can even display the configuration script used in the wireless network.

C:\>netsh wlan dump

With a little trick, you can save the script to a file:

C:\>netsh wlan dump > myconfig.txt

Then, later on you can use this myconfig.txt file on other computer directly:

C:\>netsh exec myconfig.txt

Thanks to Scott Hanselman for sharing this tip.

What’s more?

Well, you can actually use Set switch to a number of settings relating to wireless network. Like enable/disable the autoconfig.

C:\>netsh wlan set autoconfig

Interesting to give it these a try? Enjoy!

Related posts:

  1. How To Block A Computer From Accessing To A Specific Wireless Network
  2. How To Turn Your Windows 8 Computer into A Wireless Hotspot Access Point
  3. A Small Hack Showing All Your Neighbor’s WiFi Profile in Windows 7, and How You Can Optimize Your Signal
  4. How To Reveal Saved Wireless Network Password in Windows 8
  5. Windows Network Command Line: PathPing
  • http://rhor.deviantart.com Jorge Rhor

    Great!, another line of code for my unattended Windows 7 installation script.

    Thank you for the tutorial!!

  • Pingback: Wifi by gdautz - Pearltrees

  • my proud

    wow good task

  • Emesh Nepali

    what is the command line for wifi status: you know the little window that pops up when you click on status of wifi? How do you do that with command line?

    • http://about.me/kentchen Kent Chen

      I don’t think there is a command you can run to get that little ribbon pop up but you can use the following command to check the wifi status:

      netsh wlan show networks