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

In any version of Windows, how can I put my wireless network card in ad-hoc mode through the command prompt?

I want to do this because I want to hide this from the user (ie. I don't want them to have to do by themselves) I'd rather do this using an API or native windows function, but since I found no static approach in any version of Windows, I figured that the CLI is the next best thing.

share|improve this question
netsh wlan del filter permission=denyall networktype=adhoc

removes any filtering for ad-hoc networks.

You can then use

netsh wlan connect ssid="SSID" name="Profile" interface="Interface"

to connect to a network, where you need to fill in the quotation marks.

The syntax and whether parameters are optional are outlined in this TechNet document.

share|improve this answer
    
This will connect to an already existing network? Can it also be used to create/initialize a new ad-hoc network? – Unknown Oct 31 '11 at 20:35
    
@Unknown: I don't know of another way. Although you could try to figure out with Process Monitor what registry values are accessed to create such a profile and then replicate it with the reg command or by producing a .reg file and importing it. – Tom Wijsman Oct 31 '11 at 21:01

To create an adhoc wifi:

netsh wlan set hostednetwork mode=allow ssid=<your desired network name> key=<your_desired_password>
netsh wlan start hostednetwork

To stop:

netsh wlan stop hostednetwork

To get status:

netsh wlan show hostednetwork
share|improve this answer

You must log in to answer this question.

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