Properly close scripts

This commit is contained in:
SpikeHD 2022-04-23 01:10:39 -07:00
parent 3b89776d9e
commit 0356b06ea0
2 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,9 @@ set GAME_EXE_NAME=%GAME_EXE_NAME:"=%
set PROXY_IP=%2
set PROXY_IP=%PROXY_IP:"=%
:: For task killing
title PS Killswitch
:: 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: =%
@ -84,4 +87,6 @@ if "%PROXY_IP%" EQU "localhost" (
:: Reconnect to the WiFi
netsh wlan connect name="%WIFI%"
taskkill /f /fi "WINDOWTITLE eq Administrator: PS Killswitch"
exit

View File

@ -6,6 +6,9 @@
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 "%2" ""%cd%"" %4", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
)
:: Use to force task kill
title PS Launcher Script
echo Starting Proxy Server
set IP=%1
@ -60,5 +63,10 @@ if "%PROXY%" == "" (
:: Kill proxy server
taskkill /f /im mitmdump.exe
echo Done! See you next time!
timeout /t 2 /nobreak >nul
taskkill /f /fi "WINDOWTITLE eq Administrator: PS Launcher Script"
exit /b
)