Add Win32 service to run Sunshine as LocalSystem on login

This commit is contained in:
Cameron Gutman
2021-07-18 17:24:55 -05:00
parent dae9a67fe2
commit 0140989f3a
4 changed files with 194 additions and 0 deletions

24
tools/install-service.bat Normal file
View File

@@ -0,0 +1,24 @@
@echo off
set SERVICE_NAME=sunshinesvc
set SERVICE_BIN="%~dp0\tools\sunshinesvc.exe"
set SERVICE_START_TYPE=auto
rem Check if sunshinesvc already exists
sc qc %SERVICE_NAME% > nul 2>&1
if %ERRORLEVEL%==0 (
rem Stop the existing service if running
net stop %SERVICE_NAME%
rem Reconfigure the existing service
set SC_CMD=config
) else (
rem Create a new service
set SC_CMD=create
)
rem Run the sc command to create/reconfigure the service
sc %SC_CMD% %SERVICE_NAME% binPath= %SERVICE_BIN% start= %SERVICE_START_TYPE%
rem Start the new service
net start %SERVICE_NAME%