openclaw - 💡(How to fix) Fix fix(windows): suppress startup-folder cmd window flash via wscript silent launcher [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#70788Fetched 2026-04-24 05:53:36
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
mentioned ×1subscribed ×1

Root Cause

This is the startup-folder variant of the same root cause in #57682 (visible CMD window during `openclaw update` gateway restart).

RAW_BUFFERClick to expand / collapse

Problem

On Windows, the Startup folder login item (OpenClaw Gateway.cmd) launches the gateway using:

```batch start "" /min cmd.exe /d /c C:\Users<user>.openclaw\gateway.cmd ```

The `/min` flag minimizes the window but does not suppress rendering — Windows still composites the `cmd.exe` frame before minimizing it. On Windows 11 this produces a visible white/black terminal flash on screen at every login.

Root location: `src/daemon/schtasks.ts` → `renderStartupLaunchCommand()` / `buildStartupLauncherScript()`

This is the startup-folder variant of the same root cause in #57682 (visible CMD window during `openclaw update` gateway restart).

Environment

  • Windows 11 Home 10.0.26200
  • OpenClaw 2026.4.21
  • Startup folder item: `%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\OpenClaw Gateway.cmd`

Expected Behaviour

Gateway starts at login with zero visible window — no flash, no minimized taskbar entry.

Proposed Fix

Replace `start "" /min cmd.exe` with a `wscript.exe` VBScript shim. `wscript.exe` with window style `0` suppresses the window before the process is created — the frame never enters the compositor. This is the canonical Windows method for truly invisible background process launch.

The fix lives entirely in `src/daemon/schtasks.ts`. Instead of one `.cmd` in the Startup folder, generate two files:

  1. `OpenClaw Gateway.cmd` — unchanged path/name (service detector still finds it), now delegates to the `.vbs`
  2. `OpenClaw Gateway.vbs` — the silent launcher

`src/daemon/schtasks.ts` — `renderStartupLaunchCommand()`:

```typescript // BEFORE function renderStartupLaunchCommand(scriptPath: string): string { return `start "" /min cmd.exe /d /c ${quoteCmdScriptArg(scriptPath)}`; }

function buildStartupLauncherScript(opts: StartupScriptOpts): string { const lines = ['@echo off']; if (opts.description) lines.push(`rem ${opts.description}`); lines.push(renderStartupLaunchCommand(opts.scriptPath)); return lines.join('\r\n') + '\r\n'; } ```

```typescript // AFTER const VBS_LAUNCHER_FILENAME = 'OpenClaw Gateway.vbs';

// window style 0 = hidden — frame is never created, zero flash function buildStartupVbsLauncher(gatewayCmdPath: string): string { const escaped = gatewayCmdPath.replace(/"/g, '""'); return [ `Set sh = CreateObject("WScript.Shell")`, `sh.Run "cmd.exe /d /c """ & "${escaped}" & """", 0, False`, ].join('\r\n') + '\r\n'; }

function buildStartupLauncherScript(opts: StartupScriptOpts): string { const vbsPath = path.join(path.dirname(opts.startupItemPath), VBS_LAUNCHER_FILENAME); const lines = ['@echo off']; if (opts.description) lines.push(`rem ${opts.description}`); // delegate to .vbs so service detector still finds the .cmd at its registered path lines.push(`wscript.exe //nologo "${vbsPath}"`); return lines.join('\r\n') + '\r\n'; }

export { buildStartupVbsLauncher, VBS_LAUNCHER_FILENAME }; ```

Install path (wherever `installStartupFolderItem` writes the `.cmd`): also write the `.vbs` alongside it.

Uninstall path: also remove the `.vbs`.

Why Not Other Approaches

ApproachProblem
`start /min` (current)Window flashes before minimizing
PowerShell `-WindowStyle Hidden`PowerShell host itself flashes
Task Scheduler hidden flagUnreliable on interactive logon sessions
`CREATE_NO_WINDOW` in Node spawnOnly applies to Node-spawned processes, not Startup folder items launched by Windows shell
VBScript window style 0✅ No window ever created — zero flash

Verified

  • `wscript.exe` confirmed present on Windows 11 and all supported Windows versions
  • `wscript.exe //nologo` suppresses the VBScript logo banner
  • The `.cmd` path stays unchanged — `openclaw gateway status` service detection is unaffected
  • On VBScript deprecation (Windows 11 24H2+): if `wscript.exe` is eventually removed, the fallback should be a small compiled shim. Suggest adding a `// TODO(windows-vbs-deprecation)` at the generation site.

Related

  • #57682 — same root cause, update-restart variant

extent analysis

TL;DR

Replace the start "" /min cmd.exe command with a wscript.exe VBScript shim to suppress the window before the process is created.

Guidance

  • Update the renderStartupLaunchCommand function in src/daemon/schtasks.ts to use the wscript.exe VBScript shim.
  • Generate two files: OpenClaw Gateway.cmd and OpenClaw Gateway.vbs, where the .cmd file delegates to the .vbs file.
  • Use the buildStartupVbsLauncher function to create the .vbs file with a window style of 0, which suppresses the window creation.
  • Install the .vbs file alongside the .cmd file in the Startup folder.

Example

function buildStartupVbsLauncher(gatewayCmdPath: string): string {
  const escaped = gatewayCmdPath.replace(/"/g, '""');
  return [
    `Set sh = CreateObject("WScript.Shell")`,
    `sh.Run "cmd.exe /d /c """ & "${escaped}" & """", 0, False`,
  ].join('\r\n') + '\r\n';
}

Notes

  • This fix assumes that wscript.exe is present on the system, which has been verified on Windows 11 and all supported Windows versions.
  • If wscript.exe is eventually removed, a small compiled shim should be used as a fallback.

Recommendation

Apply the workaround using the wscript.exe VBScript shim, as it is the most reliable and efficient solution for suppressing the window creation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix fix(windows): suppress startup-folder cmd window flash via wscript silent launcher [1 participants]