> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# Preview the window, build the setup file and inspect it

> Use bach preview to see every window without installing, bach build to write the Setup.exe, and bach inspect to see what a setup file carries.

Once your config checks out, three commands take you the rest of the way: `bach preview` shows the window, `bach build` writes the setup file and `bach inspect` shows what a finished setup file contains. This page explains how they fit together.

## Preview the window

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach preview
bach preview --theme dark --lang de
bach preview --uninstall
```

Preview opens the real installer window built from your config, with every step pretended. Nothing is installed, so it is safe to run as often as you like. Use `--uninstall` to see the removal window, `--theme` to force `system`, `light` or `dark`, and `--lang` to see another language. Preview needs Windows; on macOS and Linux use `bach check`.

## Build the setup file

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build
```

```console theme={"theme":{"light":"github-light","dark":"github-dark"}}
$ bach build
Wrote dist\Hello-Setup-1.0.0.exe (8.7 MB)
  Packed       101.8 KB of 216.5 KB (47%), in 0.9s
```

By default the file is written to `dist/{name}-Setup-{version}.exe`. Change that with [`installer.output`](/docs/reference/config/installer) (`{name}`, `{version}` and `{id}` are filled in) or once with `--out`.

| Flag | Meaning |
| - | - |
| `--out PATH`, `-o PATH` | Write the setup file here instead of `installer.output` |
| `--fast` | Compress quickly instead of as small as possible, for this build only |
| `--runtime PATH` | The setup runtime to build on. Default: `bach-setup.exe` next to `bach`. Also read from `BACH_RUNTIME`. |

`installer.compression` sets the default: `best` makes the smallest file, `normal` and `fast` build quicker. Unpacking is fast either way.

> [!NOTE]
>
> On macOS and Linux the setup file keeps Bach's icon. Build on Windows to apply `app.icon`.

With an [`[updates]`](/docs/reference/config/updates) section that has a `download_url`, the build also writes `latest.json` next to the setup file. `bach build` exits with a non-zero code and a readable message on any problem, so it works in a pipeline as it is.

## Inspect a setup file

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach inspect "dist/Hello-Setup-1.0.0.exe"
```

`bach inspect` shows what a setup file, or an installed `uninstall.exe`, carries: the app id, publisher, program, number and size of files, install folder, options, components, link schemes, file types, languages, license, texts, requirements, shortcuts, update feed and data folders. It reads signed setup files too.

## Try the real thing

Running the built setup file is a real install on the machine you run it on. Use it deliberately, then remove the app again from **Settings › Apps**.

For tests, install silently and remove silently:

```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}}
Start-Process .\Hello-Setup-1.0.0.exe -ArgumentList '--silent' -Wait -PassThru
Start-Process "$env:LOCALAPPDATA\Programs\Hello\uninstall.exe" -ArgumentList '--silent' -Wait -PassThru
```

See [Silent installs](/docs/guides/silent-installs.md) for why this form, and the cmd version.

Exit code `0` means done, `1` failed (the reason is printed in a terminal) and `2` a flag mistake. Every run also writes a log to `%TEMP%\<app id>-setup.log`. See [Silent installs](/docs/guides/silent-installs.md).

## Next steps

> [card] [Sign your setup file](/docs/guides/signing.md)
>
> Do it after bach build, never before.

> [card] [Command reference](/docs/reference/cli/overview.md)
>
> Every command and flag.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.