solution gateway high windows

Windows: Exec tool returns empty output unless pty: true

Work around a Windows regression where non-PTY exec produces no output or side effects by forcing PTY and (optionally) capturing clean output via a temp file.

By CoClaw Team •

Symptoms

  • On Windows (10/11), exec tool calls with pty: false (or omitted) return empty output.
  • Even commands that should have side effects appear to do nothing:
    • echo test > file.txt does not create file.txt
    • Write-Output test prints nothing
  • The same commands work when pty: true.

Cause

This is a known regression affecting the Windows non-PTY execution path in some OpenClaw versions. Using pty: true routes execution through a different code path that continues to work.

Fix

1) Force PTY for all exec calls on Windows

When calling the exec tool, always include pty: true:

{ "command": "echo test", "pty": true }

2) If you need clean output, round-trip through a temp file

PTY mode can include ANSI escape sequences in the returned output. A simple workaround is to redirect output to a temp file and then read it back:

powershell -NoProfile -Command "echo test | Out-File -FilePath $env:TEMP\\exec.out -Encoding utf8; Get-Content $env:TEMP\\exec.out"

Verify

Run an exec call with pty: true:

echo test

You should see test in the tool output. If you use redirection, confirm the file actually exists and has content.

Verification & references

  • Reviewed by:CoClaw Code Team
  • Last reviewed:March 14, 2026
  • Verified on: Windows
Want to explore more? Browse all solutions or ask in the Community Forum .
Report a problem

Related Resources

Windows: tools.exec cannot find docker, rg, or gh even though they work in PowerShell
Fix
Fix native Windows cases where the Scheduled Task gateway uses a different PATH than your interactive shell, so tools.exec cannot resolve installed CLI tools.
TUI: '(no output)' or no response after sending a message
Fix
If the OpenClaw TUI shows '(no output)' or appears stuck, check connection status, gateway logs, model auth, and whether your provider only supports minimal chat payloads but not real OpenClaw runtime requests.
Windows: installer fails and PowerShell closes before you can read the error
Fix
Recover from Windows install/bootstrap failures where the one-liner closes PowerShell too quickly by switching to a readable manual install path and validating Node/npm first.
Windows: Gateway service fails to start when the user profile path is non-ASCII
Fix
Fix cases where `openclaw gateway start` works in the foreground but exits immediately when launched via Scheduled Task because the command path includes non-ASCII characters.
OpenClaw on Windows: Native vs WSL2, Install Paths, and When to Switch
Guide
A practical decision guide for Windows users: choose between native Windows and WSL2 based on service model, tool compatibility, and debugging cost, then switch paths cleanly when the platform is the problem.
OpenClaw Exec Approvals and Safe Bins: Why `tools.exec.security="full"` Can Still Be Blocked
Guide
Fix OpenClaw exec blocking without collapsing your trust model: separate approval layers, identify the real execution host, choose the right allowlist posture, and verify the fix cleanly.