mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
Re-enable WIFI and ethernet after game close
This commit is contained in:
parent
7707a067c7
commit
68a5ada88d
@ -5,6 +5,12 @@ set GAME_EXE_NAME=%GAME_EXE_NAME:"=%
|
|||||||
set PROXY_IP=%2
|
set PROXY_IP=%2
|
||||||
set PROXY_IP=%PROXY_IP:"=%
|
set PROXY_IP=%PROXY_IP:"=%
|
||||||
|
|
||||||
|
:: Get current wifi SSID to reconnect
|
||||||
|
for /f "delims=: tokens=2" %%n in ('netsh wlan show interface name="Wi-Fi" ^| findstr "Profile"') do set "WIFI=%%n"
|
||||||
|
set WIFI=%WIFI: =%
|
||||||
|
|
||||||
|
echo Wifi to reconnect to (if using Wifi): %WIFI%
|
||||||
|
|
||||||
echo Starting killswitch...
|
echo Starting killswitch...
|
||||||
|
|
||||||
if "%PROXY_IP%" EQU "localhost" (
|
if "%PROXY_IP%" EQU "localhost" (
|
||||||
@ -58,7 +64,24 @@ if "%PROXY_IP%" EQU "localhost" (
|
|||||||
goto loop
|
goto loop
|
||||||
|
|
||||||
:killgame
|
:killgame
|
||||||
echo Proxy server not running properly, killing %GAME_EXE_NAME%
|
echo Proxy server not running properly, killing %GAME_EXE_NAME% and disabling internet...
|
||||||
netsh interface set interface "Ethernet" disabled
|
|
||||||
|
:: Disable WiFi
|
||||||
|
netsh wlan disconnect
|
||||||
|
|
||||||
|
::Disable ethernet
|
||||||
|
netsh interface set interface "Ethernet" disable
|
||||||
|
|
||||||
taskkill /f /im "%GAME_EXE_NAME%"
|
taskkill /f /im "%GAME_EXE_NAME%"
|
||||||
|
|
||||||
|
echo Re-enabling internet...
|
||||||
|
|
||||||
|
:: Once the game is dead, bring back the internet
|
||||||
|
netsh interface set interface "Ethernet" enable
|
||||||
|
|
||||||
|
echo Reconnecting to %WIFI%...
|
||||||
|
|
||||||
|
:: Reconnect to the WiFi
|
||||||
|
netsh wlan connect name="%WIFI%"
|
||||||
|
|
||||||
exit
|
exit
|
Loading…
x
Reference in New Issue
Block a user