...
Expand |
---|
title | merlinconnect.cmd Windows 10 |
---|
|
Advanced code syntax highlighter |
---|
| {"code":"@echo off\n:: ----------------------------------------------------------------------------\n:: merlinconnect.cmd\n:: use: merlinconnect SSID\n:: example: merlinconnect Merlin-12345\n:: This batch script determines, if the PC is connected to the WLAN which is\n:: named as parameter no. 1 and tries to establish the connection if it's not.\n:: This script can be run in a scheduled task to ake sure that the PC connects\n:: to a requested WLAN as soon as it becomes available.\n:: ----------------------------------------------------------------------------\n\n:: Tell how to use if no parameter is passed in\nif \"%1\"==\"\" goto print_help\n\n:: Get all active IPv4 network names. If the requested network is found, quit\n@For /F Tokens^=6^ Delims^=^\" %%G In ('%SystemRoot%\\System32\\wbem\\WMIC.exe\n /NameSpace:\\\\Root\\StandardCimv2 Path MSFT_NetConnectionProfile Where\n \"IPv4Connectivity='4' And Name Is Not Null\" Get Name /Format:MOF 2^>NUL'\n) Do if %%G==%1 goto connected\n\n:: if the requested network is not found, try establishing connection\necho connect now...\nnetsh wlan connect name=\"%1\"\ngoto exit\n\n\n:: if PC is connected to requested network, say so and quit\n:connected\necho PC is connected to requested WLAN \"%1\"\ngoto exit\n\n:: print help if no parameter passed in\n:print_help\necho use merlinconnect SSID\necho note The SSID must be a valid wlan profile. Connect one manually to create it.\necho example merlinconnect Merlin-12345\ngoto exit\n\n:: exit of script\n:exit","theme":"coy","language":"batch","showLineNumbers":true} |
|
Download provided for convenience (Windows 10):
Expand |
---|
title | merlinconnect.cmd Windows 11 |
---|
|
Advanced code syntax highlighter |
---|
| {"code":"@echo off\n:: ----------------------------------------------------------------------------\n:: merlinconnect.cmd\n:: use: merlinconnect SSID\n:: example: merlinconnect Merlin-12345\n:: This batch script determines, if the PC is connected to the WLAN which is\n:: named as parameter no. 1 and tries to establish the connection if it's not.\n:: This script can be run in a scheduled task to ake sure that the PC connects\n:: to a requested WLAN as soon as it becomes available.\n:: ----------------------------------------------------------------------------\n\n:: Tell how to use if no parameter is passed in\nif \"%1\"==\"\" goto print_help\n\nnetsh wlan show interfaces | findstr /c:\"%1\" > null\nif %errorlevel% equ 1 (\n\tgoto unconnected\n) else ( \n\tgoto connected\n) \n\n:: if the requested network is not found, try establishing connection\n:unconnected\necho connect now to WLAN '%1' ...\nnetsh wlan connect name=\"%1\"\ngoto exit\n\n\n:: if PC is connected to requested network, say so and quit\n:connected\necho PC is connected to requested WLAN \"%1\"\ngoto exit\n\n:: print help if no parameter passed in\n:print_help\necho use merlinconnect SSID\necho note The SSID must be a valid wlan profile. Connect one manually to create it.\necho example merlinconnect Merlin-12345\ngoto exit\n\n:: exit of script\n:exit","theme":"coy","language":"javascript","showLineNumbers":true} |
|
Download provided for convenience (Windows 11):
Add a task to the scheduler as shown below
Note |
---|
Make sure to complete these two tests successfully after installation: Run the script in a command shell while the PC is not connected to Merlin ➡️ The script must announce that it connects to WLAN now. Run the script in a command shell while the PC is connected to Merlin. ➡️ The script must inform that the PC is already connected to Merlin.
The two variants of the script provided for download use different mechanisms to identify, if the PC is already connected to Merlin. Make sure to use the script variant that successfully detects an existing Merlin WLAN connection. |
Description | Screenshot |
---|
Run Task Scheduler | |
Name the task and set it to run irrespeecive of user login. Click on Triggers. | |
Add trigger for “At startup”. Click OK | |
Add trigger to repeat task daily every 5 minutes. Note: the script doesn’t draw a lot of performance. This scheduled execution ensures, that the connection to Merlin is made irrespective of the sequence in which PC and Merlin are booted. Click OK | |
Click on Actions | |
Add action to start a programm. Enter the path to the script. Pass the name of the WLAN to the script as parameter. Note: The WLAN must be connected once manually to create a corresponding WLAN profile in Windows. See Merlin WLAN Koppelung for details on how to do that. | |
...