Files
DevDrive/install-service.bat

62 lines
1.4 KiB
Batchfile

@echo off
:: DevDrive Startup Task Installer
:: Run as Administrator
setlocal
set TASK_NAME=DevDrive
set EXE_PATH=%~dp0DevDrive.exe
echo Installing %TASK_NAME% startup task...
echo.
:: Check for admin privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: This script requires Administrator privileges.
echo Right-click and select "Run as administrator".
pause
exit /b 1
)
:: Check if executable exists
if not exist "%EXE_PATH%" (
echo ERROR: DevDrive.exe not found at:
echo %EXE_PATH%
echo.
echo Please build the project first:
echo dotnet build
pause
exit /b 1
)
:: Remove existing task if present
schtasks /query /tn "%TASK_NAME%" >nul 2>&1
if %errorlevel% equ 0 (
echo Removing existing task...
schtasks /delete /tn "%TASK_NAME%" /f >nul 2>&1
)
:: Create scheduled task to run at logon (hidden, no console window)
echo Creating startup task...
schtasks /create /tn "%TASK_NAME%" /tr "\"%EXE_PATH%\"" /sc onlogon /rl highest /f
if %errorlevel% neq 0 (
echo ERROR: Failed to create task.
pause
exit /b 1
)
:: Start it now
echo Starting DevDrive...
schtasks /run /tn "%TASK_NAME%"
echo.
echo %TASK_NAME% installed successfully!
echo.
echo DevDrive will:
echo - Start automatically when you log in
echo - Mount the virtual drive at A:\
echo - Watch C:\PhysicalDrive\index.json for config
echo.
pause