Files
PowershellAutomation/internal/runner-launcher.vbs
T

26 lines
843 B
Plaintext

' runner-launcher.vbs
' 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
If WScript.Arguments.Count < 1 Then
WScript.Quit 1
End If
Dim runnerPath
runnerPath = WScript.Arguments(0)
Dim shell, cmd
Set shell = CreateObject("WScript.Shell")
cmd = "powershell.exe -NoLogo -NoProfile -Sta -WindowStyle Hidden -ExecutionPolicy Bypass -File """ & runnerPath & """"
' 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