Thomas Gerot
Thomas Gerot

Reputation: 50

CMD Connect to a network starting with the string

I'm writing a batch file that will automatically connect to a drone wireless network and land the drone. I want my program to work universally on all of these drones but the problem is, each of these drones has a different, unique wireless network name. However, they all do start with "ardrone". I know that I can connect to a network through command prompt by using:

netsh wlan connect name=wifiname

and I have tried:

netsh wlan connect name=ardrone*

The trouble is, such a command returns the message:

There is no profile "ardrone*" assigned to the specified interface.

Is there a way (and it can be more complex than the method I was attempting) that I can search through the available networks for one that starts with "ardrone" and connect to it? (Not a password protected network). Thanks.

Upvotes: 0

Views: 3958

Answers (1)

Im using wlan.xml

<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>Wlan</name>
<SSIDConfig>
    <SSID>
        <name>Elkjop Demo</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>false</protected>
            <keyMaterial>insert wpakey</keyMaterial>
        </sharedKey>
    </security>
</MSM>

And inject with batch command netsh wlan add profile filename=wlan.xml

Will this help you? I guess it will be the solution for the profile error?

Upvotes: 1

Related Questions