Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titlemerlinconnect.cmd Windows 11
Advanced code syntax highlighter
version24
{"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:\"Merlin-00006%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}

...

  • Add a task to the scheduler as shown below

Note

Make sure to complete these two tests successfully after installation:

  1. 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.

  2. 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

image-20240913-124030.png

Name the task and set it to run irrespeecive of user login.

Click on Triggers.

image-20240913-124538.png

Add trigger for “At startup”.

Click OK

image-20240913-124645.png

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

image-20240913-124816.png

Click on Actions

image-20240913-125040.png

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.

image-20240913-125159.png

...