Skip to content
Utility

ps-launcher

Minimal, secure PowerShell script launcher under 10KB. Runs scripts silently without console windows — ideal for Task Scheduler, login scripts, and background automation. Future-proof VBScript replacement.

CC++

Hiding a PowerShell console window so a scheduled task or login script doesn’t flash black at the user used to mean wrapping it in VBScript — and VBScript is on its way out of Windows. ps-launcher is the native replacement: a GUI-subsystem executable that starts PowerShell hidden from the very first instruction, passes through your parameters and exit code, and never shows a console.

What it does

  • Runs PowerShell scripts without showing a console window.
  • Uses the current user’s permissions and environment.
  • Preserves script parameters and exit codes.
  • Uses Windows PowerShell 5.x from the system path.
  • Logs troubleshooting details to %LOCALAPPDATA%\ps-launcher\ps-launcher.log.
  • Blocks semicolons in arguments to reduce command-injection risk.
  • Stays extremely small by avoiding framework and runtime-heavy dependencies.

Why it exists

Task Scheduler, login scripts, shortcuts, and background automation often need to run PowerShell without interrupting the user with a visible console. VBScript wrappers used to be common for this, but VBScript is deprecated and scheduled for removal from Windows. powershell.exe -WindowStyle Hidden can still flash a console during startup.

ps-launcher avoids that by being a native Windows GUI-subsystem executable that starts PowerShell hidden from the beginning.

Requirements

  • Windows.
  • Windows PowerShell 5.x.
  • The script you launch must be compatible with Windows PowerShell, not only PowerShell 7.
  • Visual Studio Build Tools only if building from source.

Usage

ps-launcher.exe -Script <script_path> [parameters]

Examples:

ps-launcher.exe -Script myscript.ps1
ps-launcher.exe -Script backup.ps1 -Path "C:\Data" -Verbose
ps-launcher.exe -Script deploy.ps1 -Environment "Production" -Force

The launcher starts PowerShell with:

  • -NonInteractive
  • -NoProfile
  • -ExecutionPolicy Bypass
  • -File

Logging

Log file:

%LOCALAPPDATA%\ps-launcher\ps-launcher.log

The log is overwritten on each run. It records parsing, script path validation, PowerShell path, command line construction, parameter processing, process creation, exit codes, and errors.

View it:

Get-Content $env:LOCALAPPDATA\ps-launcher\ps-launcher.log
notepad $env:LOCALAPPDATA\ps-launcher\ps-launcher.log
Get-Content $env:LOCALAPPDATA\ps-launcher\ps-launcher.log -Wait

Return codes

CodeMeaning
0Script completed successfully
1Launcher error, such as invalid args or missing file
otherPowerShell script exit code passed through

Script guidance

For scripts using [CmdletBinding(SupportsShouldProcess=$true)], handle non-interactive execution explicitly:

if ([Environment]::UserInteractive -eq $false) {
    $ConfirmPreference = 'None'
}

Test scripts with powershell.exe, not only pwsh.exe, because ps-launcher targets Windows PowerShell 5.x.

Security notes

  • The launcher uses the full system path to Windows PowerShell.
  • It validates that the script file exists.
  • It rejects semicolons in arguments.
  • It quotes parameters containing spaces.
  • It propagates script exit codes for scheduled-task monitoring.

Build from source

compile.bat

Manual MSVC build:

call "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
cl /c /GS- /O1 /Os ps-launcher.c
link /NODEFAULTLIB /ENTRY:WinMain /SUBSYSTEM:WINDOWS kernel32.lib user32.lib shell32.lib /OUT:ps-launcher.exe ps-launcher.obj

Troubleshooting

Script does not run

Check the log file first. It will show argument parsing, script path validation, and process creation errors.

Works in PowerShell 7 but not ps-launcher

Port the script to Windows PowerShell 5.x compatibility.

Task Scheduler prompts or hangs

Make the script non-interactive. Avoid prompts, and set $ConfirmPreference = 'None' for ShouldProcess scripts.

  • GitHub: https://github.com/Swatto86/ps-launcher
  • Releases: https://github.com/Swatto86/ps-launcher/releases
← All tools