Created
January 7, 2015 11:15
-
-
Save knyga/b6cd3d17fe96e824bdfd to your computer and use it in GitHub Desktop.
Automatically reconnects to wifi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@set @x=0; /* | |
@echo off | |
SetLocal EnableDelayedExpansion | |
ver |>NUL find "6." && if "%1" neq "Admin" ( | |
cscript.exe //nologo //e:jscript "%~f0" | |
Exit | |
) | |
:begin | |
set Try=0 | |
:Counter | |
ping -n 1 8.8.8.8 |>nul find /i "TTL=" && ( | |
>NUL ping -n 31 127.1 | |
goto begin | |
) || ( | |
set /A Try+=1 | |
if !Try!==4 ( | |
call :reconnect | |
goto begin | |
) | |
>NUL ping -n 4 127.1 | |
goto Counter | |
) | |
:reconnect | |
netsh interface set interface name="Wi-Fi" admin=DISABLED | |
netsh interface set interface name="Wi-Fi" admin=ENABLED | |
exit /B | |
*/new ActiveXObject('Shell.Application').ShellExecute (WScript.ScriptFullName,'Admin','','runas',1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment