add launcher

This commit is contained in:
2026-09-17 15:10:46 +08:00
parent 1962d3f8a7
commit a2b0bba05f
10 changed files with 778 additions and 3 deletions

35
launcher/setup.bat Normal file
View File

@@ -0,0 +1,35 @@
@echo off
setlocal
set "TASK_NAME=qmt_launcher"
set "LAUNCHER_EXE=%~dp0start.exe"
if not exist "%LAUNCHER_EXE%" (
call "%~dp0build.bat"
if errorlevel 1 (
echo Failed to prepare start.exe.
pause
exit /b 1
)
)
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
"$ErrorActionPreference = 'Stop';" ^
"$taskName = '%TASK_NAME%';" ^
"$launcherDir = (Resolve-Path -LiteralPath '%~dp0').Path;" ^
"$workingDir = Split-Path -Parent $launcherDir;" ^
"$launcherExe = Join-Path $launcherDir 'start.exe';" ^
"$action = New-ScheduledTaskAction -Execute $launcherExe -WorkingDirectory $workingDir;" ^
"$trigger = New-ScheduledTaskTrigger -AtLogOn -User ([System.Security.Principal.WindowsIdentity]::GetCurrent().Name);" ^
"$principal = New-ScheduledTaskPrincipal -UserId ([System.Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive -RunLevel Highest;" ^
"$settings = New-ScheduledTaskSettingsSet -Hidden:$false;" ^
"Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force | Out-Null"
if errorlevel 1 (
echo Failed to create task "%TASK_NAME%".
pause
exit /b 1
)
echo Task "%TASK_NAME%" created or updated successfully with a visible window.
pause
exit /b 0