From 2e54d0b1217a129cc51c1af005e00eed695b1044 Mon Sep 17 00:00:00 2001 From: Arne Moerman Date: Tue, 12 May 2026 11:09:47 +0200 Subject: [PATCH] Add configure.bat for executing PowerShell script and update runner-launcher.vbs comments for clarity --- configure.bat | 2 ++ internal/runner-launcher.vbs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 configure.bat diff --git a/configure.bat b/configure.bat new file mode 100644 index 0000000..9e90a1d --- /dev/null +++ b/configure.bat @@ -0,0 +1,2 @@ +@echo off +powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0configure.ps1" diff --git a/internal/runner-launcher.vbs b/internal/runner-launcher.vbs index 65d3f2b..4765a44 100644 --- a/internal/runner-launcher.vbs +++ b/internal/runner-launcher.vbs @@ -1,8 +1,7 @@ ' runner-launcher.vbs -' Starts runner.ps1 without a visible console window. -' Uses a shown/minimized style (not 0) so the process joins the interactive window station, -' which is required for WinForms dialogs to appear. PowerShell's own -' -WindowStyle Hidden suppresses the console window. +' Starts runner.ps1 without stealing foreground focus. +' Uses a minimized/no-activate launch style so the process stays interactive +' for dialogs without jumping in front of the active window. Option Explicit @@ -17,9 +16,10 @@ Dim shell, cmd Set shell = CreateObject("WScript.Shell") cmd = "powershell.exe -NoLogo -NoProfile -Sta -WindowStyle Hidden -ExecutionPolicy Bypass -File """ & runnerPath & """" -' Window style 1 = SW_SHOWNORMAL — do NOT use 0 here. -' Style 0 (CREATE_NO_WINDOW) detaches the process from the interactive -' window station, which prevents WinForms dialogs from rendering. -' PowerShell's own -WindowStyle Hidden flag suppresses the console window. -shell.Run cmd, 1, False +' Window style 7 = SW_SHOWMINNOACTIVE. +' Do not use style 0 here; that can prevent interactive dialogs from rendering. +' PowerShell's own -WindowStyle Hidden should suppress the console, while the +' shell launch style avoids foreground activation if a window is created briefly. +shell.Run cmd, 7, False + WScript.Quit 0