-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
85 lines (73 loc) · 2.48 KB
/
setup.bat
File metadata and controls
85 lines (73 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
@echo off
setlocal enabledelayedexpansion
title EndTask10 Setup
:: Auto-elevate to admin (required to stop services that auto-restart apps)
net session >nul 2>&1
if %errorlevel% neq 0 (
echo [INFO] Requesting administrator privileges...
powershell -Command "Start-Process '%~dpnx0' -Verb RunAs -Wait" 2>nul
exit /b 0
)
set "APP_DIR=%LOCALAPPDATA%\EndTask10"
set "BUILD_DIR=%~dp0build\bin\Release"
if not exist "%BUILD_DIR%\EndTask10Launcher.exe" (
echo [ERROR] Build not found. Run build.bat first.
pause & exit /b 1
)
echo =====================================
echo EndTask10 - Setup
echo =====================================
echo.
:: Try to stop known services that auto-restart killed processes
echo [INFO] Stopping services that may auto-restart apps...
for %%s in (
"Steam Client Service"
"Steam Client Service64"
"Epic Online Services"
"EpicGamesLauncher"
) do (
sc stop "%%~s" >nul 2>&1 && echo [OK] Stopped: %%~s || echo [---] Not running: %%~s
)
:: Try unload first (for new DLLs that support it)
"%APP_DIR%\EndTask10Launcher.exe" /unload >nul 2>&1
:: Create app dir
if not exist "%APP_DIR%" mkdir "%APP_DIR%"
:: Copy exe
copy /Y "%BUILD_DIR%\EndTask10Launcher.exe" "%APP_DIR%\" >nul
if errorlevel 1 ( echo [FAIL] exe copy & pause & exit /b 1 )
echo [OK] Copied EndTask10Launcher.exe
:: Copy DLL (retry if locked)
copy /Y "%BUILD_DIR%\EndTask10Hook.dll" "%APP_DIR%\" >nul 2>&1
if errorlevel 1 (
echo [WARN] DLL in use by explorer. Trying again after unload...
"%APP_DIR%\EndTask10Launcher.exe" /unload >nul 2>&1
ping -n 3 127.0.0.1 >nul
copy /Y "%BUILD_DIR%\EndTask10Hook.dll" "%APP_DIR%\" >nul 2>&1
if errorlevel 1 (
echo [FAIL] Copy later manually: %BUILD_DIR%\EndTask10Hook.dll -^> %APP_DIR%\
echo Or just use the build directory directly.
goto :reg
)
)
echo [OK] Copied EndTask10Hook.dll
:reg
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ^
/v "EndTask10" /t REG_SZ ^
/d "\"%APP_DIR%\EndTask10Launcher.exe\"" /f >nul 2>&1
echo [OK] Added to startup
echo.
echo Injecting...
"%APP_DIR%\EndTask10Launcher.exe"
echo.
echo =====================================
echo Ready! Hover over taskbar icon ^> Ctrl+Shift+E
echo.
echo Or: Right-click + Ctrl+Shift+E
echo.
echo Note: Services stopped above prevent auto-restart for
echo those apps (Steam, Epic, etc.) for this session.
echo.
echo Unload: %APP_DIR%\EndTask10Launcher.exe /unload
echo =====================================
echo.
pause