{"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} |