Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I searched a lot related to netsh and ipconfig /renew and ipconfig /release.

My idea is to write a batch file that would automatically connect to a particular wireless local area network using a network interface .

I tried using ipconfig /renew release ... but it cannot be used as my intention is to keep the media in a disconnected state before running the batch file ..

any suggestions ?


Narrowed it down to

connect name=Profile2 ssid=SSID2 interface="Wireless Network Connection"

Where do i find the "name" in network and sharing center?

share|improve this question

migrated from Jun 2 '11 at 8:11

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

What about:

netsh wlan connect=SSID

share|improve this answer
Hi Peehaa thanks for quick reply :) ... I tried that too .. the same poster says that the method has been lost and has been downgraded ... – HelloWorld_Always Jun 2 '11 at 0:20
@HelloWorld_Always: The poster says the reason the method got lost is because he downgraded his OS from Vista -> XP. So I don't know what clients you want to support with the batch file, but I you use >= Vista you should be ok. What error did you get when trying the method or are you on XP? – PeeHaa Jun 2 '11 at 0:28
it workd .. sorry for accepting after a long time – HelloWorld_Always Jun 24 '11 at 17:17
@HelloWorld_Always: No problem. Glad I could resolve your issue. And thanks for accepting the answer so other users know it works :) – PeeHaa Jun 24 '11 at 20:51

Same as PeeHaa

Usage: connect [name=]<string> [[ssid=]<string>] [[interface=]<string>]

but Scott Hanselman provides good information on most netsh wlan commands.

D:\>netsh wlan

The following commands are available:

Commands in this context:
?              - Displays a list of commands.
add            - Adds a configuration entry to a table.
connect        - Connects to a wireless network.
delete         - Deletes a configuration entry from a table.
disconnect     - Disconnects from a wireless network.
dump           - Displays a configuration script.
export         - Saves WLAN profiles to XML files.
help           - Displays a list of commands.
refresh        - Refresh hosted network settings.
reportissues   - Generate WLAN smart trace report.
set            - Sets configuration information.
show           - Displays information.
start          - Start hosted network.
stop           - Stop hosted network.

To view help for a command, type the command, followed by a space, and then
 type ?.
share|improve this answer

To disconnect from a wireless network

netsh wlan disconnect interface="wireless adapter name"

To connect to a wireless network

netsh wlan connect name="wireless network profile name" ssid="As you known" interface="wireless adapter name"

You can get profile name, interface name by

netsh wlan show interface/profile

You will need to create a profile for the wireless network first which you can do in "Wireless network management" under "Network and sharing center" in Control panel.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .