Skip to content

Instantly share code, notes, and snippets.

@knyga
Created January 7, 2015 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knyga/b6cd3d17fe96e824bdfd to your computer and use it in GitHub Desktop.
Save knyga/b6cd3d17fe96e824bdfd to your computer and use it in GitHub Desktop.
Automatically reconnects to wifi
@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