windows-desktop-automation
Skill1 starsChanged 37 days agoMITView on GitHub
Code spawning CLIs/SendKeys on Windows? Exact argv, focus.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- eygelias/Hermes-Custom-Skillstheir own version, first seen Oct 11, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- eygelias/Hermes-Custom-Skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository34 other files it gives its agents.
- agent-branch-integrationSkill
- agent-config-syncSkill
- blocked-page-recoverySkill
- brand-retrofitSkill
- clickable-concept-prototypeSkill
- codebase-inspectionSkill
- commit-workSkill
- contrastive-refactor-demoSkill
- custom-domain-emailSkill
- delegate-coding-taskSkill
- delegated-agent-supervisionSkill
- delivery-verificationSkill
- domain-dns-cutoverSkill
- first-run-onboardingSkill
- frontend-render-performanceSkill
- github-pages-deploySkill
- hermes-cron-jobsSkill
- hermes-messaging-channelsSkill
- hermes-on-oracle-free-tierSkill
- hermes-provider-credentialsSkill
- isolated-worktree-testingSkill
- measurement-validitySkill
- multi-layout-previewSkill
- new-project-scaffoldingSkill
- parallel-agent-fanoutSkill
- premortemSkill
- recall-and-claim-verificationSkill
- single-source-training-materialsSkill
- stakeholder-decision-elicitationSkill
- static-site-vps-deploySkill
- supabase-auth-debuggingSkill
- windows-background-process-hygieneSkill
- windows-performance-tuningSkill
- worktree-analysisSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Check which PowerShell and which binary actually run: Look at $PSVersionTable (5.1 is the default) and at Get-Command tool / where tool.
- Distinctive: line 41
Fix window typing: add a focus guard, deliver to existing windows before spawning new ones, and serialize delivery globally.
- Distinctive: line 61
Check the 32767-char command-line cap: before launching. Fail with a clear error and point to a file or attachment for long content.
- Distinctive: line 65
Delete temp files at the top of the script, because code after an interactive TUI only runs on exit.
- Distinctive: line 86
Only the following anchor has the verification scope recorded below.
- Very specific: line 88
Run python scripts/test_boundary.py from this directory.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Windows desktop automation from code
For code (Node, Python, etc.) that opens a CLI in a new PowerShell window, passes it
arbitrary text (prompts, paths), or types into an existing window with clipboard +
WScript.Shell.SendKeys. Typical bugs: prompts that arrive split or empty, flags that eat
the positional argument, and keystrokes that land in the wrong window when several jobs
run together.
Hidden-window and console-flash problems belong to a separate hidden-process diagnostic workflow.
When to Use
- Prompts or paths reach a spawned CLI split, missing quotes, or reported as "no prompt
provided", especially when the text contains
"or when an attachment/extra-dir flag is present. - A scheduler or bot types into existing windows, and text lands in the wrong window when several targets, or several jobs at the same minute, are handled.
- You're writing a new tool that generates .ps1 launchers or uses clipboard + SendKeys.
Procedure
- Reproduce at the argv boundary before reading more code. Swap the target exe for a
stand-in that dumps argv (
node -e "console.log(JSON.stringify(process.argv.slice(2)))") and feed it the exact generated script and text. For the real CLI, run once in its non-interactive mode (-p,--print) with--helpopen. A "missing argument" error means a flag took the positional as a value. - Check which PowerShell and which binary actually run. Look at
$PSVersionTable(5.1 is the default) and atGet-Command tool/where tool. It may be a.ps1/.cmdnpm shim rather than the.exe. - Fix argument passing with the recipe below. Verify with the argv dump against a hostile corpus.
- Fix window typing: add a focus guard, deliver to existing windows before spawning new ones, and serialize delivery globally.
- Lock it in with offline tests that run the real generated PowerShell with the desktop calls stubbed (see reference). Then do one smoke run against the real exe.
- Report what was verified against the real binary versus the stubs, and say plainly what stayed unverified (real SendKeys into a live window takes over the user's desktop, so don't do it unasked).
Rules
- Windows PowerShell 5.1 does not escape embedded
"in native-command arguments.& exe $textsplits any text containing quotes, so any prompt with JSON-quoted paths breaks. Build the command line in the host language with MSVC/CommandLineToArgvWquoting. Pass it through the stop-parsing token from an env var:& 'C:\full\tool.exe' --% %TOOL_ARGS%. - Invoke the real
.exeby full path, never the npm.ps1/.cmdshim. Shims re-splat$args/%*and re-break the quoting. Resolve from PATH (including<prefix>\node_modules\@scope\pkg\bin\tool.exe) and offer an override env var. - Put
--before a positional argument that follows a variadic option (e.g.--add-dir <dirs...>). The parser otherwise takes the positional as one more value. - Check the 32767-char command-line cap before launching. Fail with a clear error and point to a file or attachment for long content.
- Generated .ps1 files: UTF-8 with BOM (PS 5.1 reads BOM-less files as ANSI). Quote every
interpolated value as a single-quoted literal (
'→''). Use-LiteralPathfor paths. Delete temp files at the top of the script, because code after an interactive TUI only runs on exit. - SendKeys types into whatever window is in front.
AppActivatereturning true isn't enough. CompareGetForegroundWindow()with the targetMainWindowHandleimmediately before the paste and before Enter, and abort with a one-line error if they differ. - Within one batch, type into existing windows before opening new ones. New consoles take focus asynchronously. Keep reported results in input order.
- Clipboard and focus are global: jobs that fire in the same tick must run through one
serial promise chain/queue. Chain with
.catchso one failure doesn't stall the rest. - Show users the first line of PowerShell errors and log the full record. ErrorRecord dumps are unreadable in a UI.
Support files
references/argv-quoting-and-test-harness.md: the quoting function, the--%script template, the tested hostile-input corpus, the focus-guard snippet, and how to run the real generated PowerShell offline (stubbed cmdlets, node as fake exe, 8.3 path pitfall).
Runnable public anchor
Reference snippets illustrate integration recipes, not standalone tested programs. Only the following anchor has the verification scope recorded below.
Run python scripts/test_boundary.py from this directory. See verification for scope and negative tests.
Attribution
Prepared by Rafael with AI assistance. Adapted from private procedural notes whose recorded author was hermes-curator. This is not a claim of sole authorship of those notes. Third-party tools retain their own licenses.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

