> ## 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.

# Setup file options

> Every command-line option of a Bach setup file: silent installs, folder, options, language, logging, repair, keys, and how mistakes are handled.

Every setup file you build accepts these options. They don't need anything in `bach.toml`. The uninstaller has its own options: see [Uninstaller options](/docs/reference/setup/uninstaller.md).

A setup file is a windows program, so a terminal doesn't wait for it. To wait and get the exit code:

```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}}
$p = Start-Process ".\Hello-Setup-1.4.0.exe" -ArgumentList '--silent' -Wait -PassThru
$p.ExitCode
```

In Command Prompt: `start /wait "" Hello-Setup-1.4.0.exe --silent`, then `echo %ERRORLEVEL%`.

## Options

| Option | Meaning |
| - | - |
| `--silent`, `/S`, `/silent`, `/quiet`, `/q`, `/VERYSILENT`, `/qn`, `/qb` | Install without a window |
| `--dir FOLDER`, `/DIR=FOLDER`, `/D=FOLDER` | Folder for a first install, if the app allows choosing. Full path. `/D=` takes the rest of the line, like NSIS. |
| `--with IDS` | Turn options on, comma-separated |
| `--without IDS` | Turn options off |
| `--lang CODE` | Language for messages and window |
| `--log FILE` | Log file. Default `%TEMP%\<app id>-setup.log` |
| `--allow-downgrade` | Silent: install over a newer version |
| `--overwrite` | Silent first install: replace files already in the folder |
| `--skip-requirements` | Silent: install even if a requirement isn't detected |
| `--repair` | With the setup file of the installed version: restore missing or changed files, shortcuts and registration |
| `--key-file FILE` | Access key (first line of the file). Or set `BACH_ACCESS_KEY`. |
| `--theme THEME` | `light`, `dark` or `system` |
| `--help`, `-h`, `/?` | Print all options |

`/NORESTART`, `/SP-`, `/SUPPRESSMSGBOXES`, `/NOCANCEL`, `/NCRC`, `/CLOSEAPPLICATIONS`, `/NOCLOSEAPPLICATIONS`, `/RESTARTAPPLICATIONS` and `/NORESTARTAPPLICATIONS` from Inno Setup and NSIS are accepted and ignored, so existing scripts keep working.

## Option ids

| Id | Option |
| - | - |
| `desktop-shortcut` | Desktop shortcut |
| `start-menu` | Start menu shortcut |
| `autostart` | Start with Windows |
| `path` | Add to PATH |
| `auto-update` | Automatic updates |
| a component's `id` | That component |

Only options the window would offer can be changed. An unknown id ends with exit code 2 and lists the valid ones.

## Preview options

`--preview` shows the window without installing. With it, `--uninstall` shows removal, and `--style NAME` and `--layout NAME` try other looks. `bach preview` uses these.

## On macOS

On a Mac, the program that takes these options is inside the Setup app:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
"Install Hello.app/Contents/MacOS/bach-setup" --silent
```

The installed uninstaller is `Contents/MacOS/bach-setup` inside `Uninstall Hello.app`, in `~/Library/Application Support/Bach/uninstallers/<app id>`. The options are the same, with these differences:

* Use the `--` spellings. `/S` and the Inno Setup and NSIS switches are for Windows.
* The log goes to the temporary folder by default.
* `desktop-shortcut` is a link on the Desktop, `start-menu` a link in Applications, and `autostart` means open at login.
* A shell waits for the program, so `$?` holds the [exit code](/docs/reference/setup/exit-codes.md).
* Downloaded updates are kept in `~/Library/Application Support/Bach/updates/<app id>`.

The uninstaller also has `--cleanup-if-removed`, which the watcher left by setup runs. When the app has been moved to the Trash, it removes what setup added around it (links, launch agents, the `PATH` block, the install record and the uninstaller), but never the user's data.

## How the command line is read

Values follow a space or `=` (`--dir "D:\Apps\Hello"` or `--dir="D:\Apps\Hello"`). Options ignore case and can start with `--` or `/`. `--with` and `--without` can repeat. Any mistake stops with exit code 2 before anything happens: an unknown option, a stray word, a missing value, a value where none belongs, a bad `--theme`, or `--style` without `--preview`. In a terminal the message is printed; a double-clicked file shows a message box; services get only the exit code.


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