windows-agent-automationlisted
Install: claude install-skill hellokianben-collab/vishal-agarwal-context
# Windows automation traps
Environment: **Windows 11**, PowerShell **5.1**, Git Bash available, Node + Python 3.14, no `gh` CLI.
---
## 1. `claude` and `vercel` on PATH are `.cmd` shims — this is the expensive one
Two separate failures, both silent:
**a) Multi-line input passed as an argv element is truncated at the first newline.**
```python
# WRONG — cmd.exe cuts the prompt at the first \n. The model answers a question it never received.
subprocess.run([claude, "-p", long_multiline_prompt])
# RIGHT — pipe through stdin
subprocess.run([claude, "-p"], input=long_multiline_prompt, text=True, encoding="utf-8")
```
The output looks *plausible*, which is why this can survive for days. If a model's answer seems to
ignore most of your prompt, check this before anything else.
**b) `subprocess` cannot resolve the bare name.**
```python
import shutil
claude = shutil.which("claude") # → the full .cmd path
if not claude: raise RuntimeError("claude not on PATH")
```
`shell=True` also "works" and brings quoting problems with it. Resolve the path instead.
## 2. PowerShell 5.1 is missing operators you will reach for
| Not available | Use |
|---|---|
| `&&` | `A; if ($?) { B }` |
| `\|\|` | `A; if (-not $?) { B }` |
| ternary `? :` | `if/else` |
| `??`, `?.` | explicit `if ($null -eq $x)` |
| `ConvertFrom-Json -AsHashtable` | returns `PSCustomObject`; index accordingly |
**Do not redirect a native executable's stderr with `2>&1`.** PowerShell 5.1 wraps each line in an
Error