diff --git a/gitea-python-ci-cd.md b/gitea-python-ci-cd.md index 6d75625..5539da9 100644 --- a/gitea-python-ci-cd.md +++ b/gitea-python-ci-cd.md @@ -342,7 +342,11 @@ InstallDir "$LOCALAPPDATA\${APPNAME}" RequestExecutionLevel user ; Optional: launch app after install (checkbox on finish page) -!define MUI_FINISHPAGE_RUN "$INSTDIR\MyApp.bat" +; Direct bat approach (shows brief console flash): +; !define MUI_FINISHPAGE_RUN "$INSTDIR\MyApp.bat" +; Preferred: VBS hidden launcher (no console window at all): +!define MUI_FINISHPAGE_RUN "wscript.exe" +!define MUI_FINISHPAGE_RUN_PARAMETERS '"$INSTDIR\scripts\start-hidden.vbs"' !define MUI_FINISHPAGE_RUN_TEXT "Launch ${APPNAME}" ; Sections @@ -355,6 +359,23 @@ Section "Start with Windows" SecAutostart ; Optional — Startup folder shortcut ; But NOT $INSTDIR\data (user config) ``` +### Hidden Launcher (VBS) + +Bat files briefly flash a console window even with `@echo off`. To avoid this, +use a VBS wrapper that all shortcuts and the finish page point to: + +```vbs +Set WshShell = CreateObject("WScript.Shell") +scriptDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) +appRoot = CreateObject("Scripting.FileSystemObject").GetParentFolderName(scriptDir) +WshShell.CurrentDirectory = appRoot +' Run bat completely hidden (0 = hidden, False = don't wait) +WshShell.Run """" & appRoot & "\MyApp.bat""", 0, False +``` + +Place in `scripts/start-hidden.vbs` and bundle it in the build script. +All NSIS shortcuts use: `"wscript.exe" '"$INSTDIR\scripts\start-hidden.vbs"'` + **CI dependencies:** `sudo apt-get install -y nsis msitools zip` Build: `makensis -DVERSION="${VERSION}" installer.nsi`