From e32cf5fe5834f287617715ec2ff1d03bdeb6309d Mon Sep 17 00:00:00 2001 From: "dolgolyov.alexei" Date: Mon, 23 Mar 2026 13:53:19 +0300 Subject: [PATCH] docs: add VBS hidden launcher pattern to CI/CD guide Document the VBS wrapper approach for launching Windows apps without console window flash. Update NSIS example to prefer VBS over direct bat execution. --- gitea-python-ci-cd.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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`