From 0356b06ea0d1740431246f26388c45f0e0fb0972 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sat, 23 Apr 2022 01:10:39 -0700 Subject: [PATCH] Properly close scripts --- scripts/killswitch.cmd | 5 +++++ scripts/private_server_launch.cmd | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/scripts/killswitch.cmd b/scripts/killswitch.cmd index 0c8e8ec..9c1465f 100644 --- a/scripts/killswitch.cmd +++ b/scripts/killswitch.cmd @@ -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 \ No newline at end of file diff --git a/scripts/private_server_launch.cmd b/scripts/private_server_launch.cmd index a9ea591..1a15d66 100644 --- a/scripts/private_server_launch.cmd +++ b/scripts/private_server_launch.cmd @@ -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 ) \ No newline at end of file