# Panes

Canonical: https://usepanes.com/docs/commands

## Commands

POST `/v1/machines/{id}/exec` runs one PowerShell script or an `argv` array. Choose exactly one. Commands run as SYSTEM by default. **Set `desktop: true` for Office** so execution uses the signed-in desktop.

```json
{"script":"param($Name) Set-Content C:/work/name.txt $Name; Get-Content C:/work/name.txt","params":{"Name":"Quarterly report"},"desktop":true,"timeout_s":60}
```

Pass untrusted values through `params` or `stdin`; do not interpolate them into a script. Parameters are strings. An `argv` request runs a program without PowerShell quoting:

```json
{"argv":["C:/tools/report.exe","--out","C:/work/result.csv"],"timeout_s":600}
```

The response is `{"exit_code":0,"stdout":"…","stderr":"","ms":123}`, with `timed_out: true` when the timeout stops the command. Check every result, even on HTTP 200. Set the caller's HTTP deadline longer than `timeout_s` plus transport overhead. Use the direct API origin for long commands. Write large results to files and download them.

A disconnected or timed-out HTTP request does not prove the command failed. Inspect a task marker, output files and computer state before repeating commands. SDKs flag uncertain writes; they do not automatically retry them.
