...
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:\"Merlin-00006\" > 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):
...