Batch Skript To Connect To Wifi Until 10 Seconds.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Vinzenz
Posts: 1
Joined: 07 Oct 2017 07:15

Batch Skript To Connect To Wifi Until 10 Seconds.

#1 Post by Vinzenz » 07 Oct 2017 08:07

Hello,
I´m new in this forum, because in need help writing a specific script for my brother´s PC for connecting with our Wifi after 10s, he started his PC. It´s a Tower, so he
is using an adapter to get wifi, but this causes problems, when the wlan is on during the booting up. Therefor i want to write a batch script, that solves this problem with a little countdown:

Code: Select all

timeout>nul /t 10 /nobreak

After this short periode the batch-file should start his wifi and connecting to our Wlan "FRITZ!Box Fon WLAN 7390" with the example keyword "123456".
I tried it already with this code

Code: Select all

netsh wlan add profile filename="WiFi-FRITZ!Box Fon WLAN 7390.xml" interface="Wifi" user=current
netsh wlan connect name="WiFi-FRITZ!Box Fon WLAN 7390.xml" ssid="FRITZ!Box Fon WLAN 7390" interface="WiFi"
pause

Of course I created a XML file for my Wlan, but it doest work at all.
At the end I would copy the finished batch in the autorun folder
Please help.

Vinzenz

PS: We both use win10 and the same network

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Batch Skript To Connect To Wifi Until 10 Seconds.

#2 Post by aGerman » 07 Oct 2017 12:56

First of all make sure the connection mode was set to manual.

Code: Select all

netsh wlan set profileparameter name="FRITZ!Box Fon WLAN 7390" connectionmode=manual


Now you can export the profile to an xml file.

Code: Select all

netsh wlan export profile "FRITZ!Box Fon WLAN 7390" key=clear


You can import the file on another computer using

Code: Select all

netsh wlan add profile filename="WiFi-FRITZ!Box Fon WLAN 7390.xml" user=all
Make sure the xml file is in the same directory as the batch file (or the working directory of the cmd prompt).


Once the profile exists you don't need to add it anymore. So your autorun batch file should look like that

Code: Select all

@echo off
>nul timeout /t 10 /nobreak
netsh wlan connect name="FRITZ!Box Fon WLAN 7390"


Steffen

Post Reply