A CLI for automating Windows applications built on FlaUI.
flaui-cli gives scripts and coding agents a simple command-line interface for driving Windows applications through UI Automation. It keeps a background daemon alive between invocations, remembers the currently attached window, and refreshes element refs through YAML snapshots.
This project is inspired by playwright-cli.
- CLI-first workflow for Windows applications automation
- Built on FlaUI UIA3
- Background daemon keeps the attached window alive across commands
- Snapshot-based element refs such as
e1,e2,e3 - Built-in screenshot and text extraction commands
- Windows x64
- .NET 10 SDK or newer
- A Windows application that exposes useful UI Automation data
dotnet tool install --global flaui-cli # Install the CLI globally
gh skill install zzzkan/flaui-cli flaui-cli # Install agent skills
flaui-cli --helpflaui-cli uses an internal background daemon to preserve state between separate CLI invocations.
- The first command starts the daemon automatically.
- The daemon exits after 5 minutes of inactivity.
launchorattachselects the managed window.snapshotwrites the current accessibility tree to.flaui-cli/snapshot-<timestamp>.yml.- The latest snapshot defines the valid element refs for the current attached window.
- If the UI changes and a ref no longer resolves, run
snapshotagain.
Snapshot entries look like this:
- button "OK" [ref=e12]In a fresh snapshot, the attached window itself is written first, so the root window ref is e1.
Artifacts are written to .flaui-cli/ in the current working directory:
snapshot-*.ymlscreenshot-*.png
Use Notepad as a quick smoke test:
flaui-cli launch notepad.exeThis launches Notepad, attaches its first visible top-level window, and writes a snapshot file under .flaui-cli/.
Open the generated snapshot and find the ref for the editor control. Then continue with commands like these:
flaui-cli fill e3 "Hello from FlaUI CLI"
flaui-cli get-text e3
flaui-cli screenshot e1
flaui-cli close e1In that flow:
e3is an example editor ref from the latest snapshot.e1is the root Notepad window from the latest snapshot.
Attach to an already running application by matching a window title substring.
flaui-cli list
flaui-cli attach "Calculator"
flaui-cli snapshotattach performs a case-insensitive substring match against visible top-level desktop windows.
flaui-cli launch <filename> [--args "..."]
flaui-cli attach <title>
flaui-cli list
flaui-cli focus <ref>
flaui-cli close <ref>launchlaunches an application and attaches its first visible top-level windowattachattaches a visible top-level desktop window by title substringlistlists visible top-level desktop windowsfocusfocuses a window from the latest snapshotclosecloses a window from the latest snapshot
flaui-cli snapshot
flaui-cli screenshot <ref>
flaui-cli get-text <ref>snapshotwrites the current accessibility tree to.flaui-cli/snapshot-*.ymlscreenshotcaptures an element or window into.flaui-cli/screenshot-*.pngget-textreads text content from an element
flaui-cli click <ref> [--button left|right] [--double]
flaui-cli fill <ref> <value>clickclicks or double-clicks an element from the latest snapshotfillreplaces the value of a text field