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

# Install for every user with one administrator prompt

> Install your app for every user of a computer with installer.scope = machine: one Windows prompt, Program Files, HKLM, elevated run steps and what changes.

By default a Bach setup file installs for the person who runs it and never asks for administrator rights. When an app has to be there for every user of a computer, set `installer.scope = "machine"`: setup then installs into `%ProgramFiles%` and `HKLM` after a single Windows prompt. This page shows how it behaves, what moves to the computer's side and what to watch out for.

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[installer]
scope = "machine"
```

## What happens

Setup starts again with administrator rights before it does anything. Windows shows its prompt once, or asks for an administrator's password, and then the whole install runs elevated. Nothing is hidden from that prompt. A setup run from an elevated terminal, or by a deployment tool that already has the rights, does not ask.

The uninstaller works the same way: when Settings › Apps starts `uninstall.exe`, it starts itself again elevated first. An update started by the app asks when its setup file starts.

## What moves

| | Per user (`"user"`, default) | Machine-wide (`"machine"`) |
| - | - | - |
| Install folder | `%LOCALAPPDATA%\Programs\<folder>` | `%ProgramFiles%\<folder>` |
| Settings › Apps entry | `HKCU` | `HKLM` |
| Start menu and desktop shortcuts | The user's | Every user's |
| Start with Windows, link schemes, file types | `HKCU` | `HKLM` |
| `PATH` (`add_to_path`) | The user's | The computer's |
| `[[registry]]`, `[[env]]`, `[[context_menu]]` | `HKCU` | `HKLM` |
| Administrator prompt | Never | Once, at the start |

## Silent installs

`--silent` works the same way. Run from a terminal that is not elevated, it shows Windows' prompt, and declining it exits with code 1. Deployment tools that run setup elevated or as SYSTEM see no prompt. See [Silent installs](/docs/guides/silent-installs.md).

## Things to know

* **No background updates.** An update has to write to Program Files, which a signed-in user cannot do. `[updates] auto` must be left out or `"never"`. The app can still use `--check-update`, `--download-update` and `--update`, and Windows asks when the update installs.
* **The install folder has to be inside Program Files.** A machine-wide app runs, updates and uninstalls with administrator rights, so setup refuses a folder that the user's own programs could write to, with the usual "choose another folder" message. Even inside Program Files, setup reads the folder's access list before it writes, and again before an elevated update or removal. A folder that Users, Authenticated Users or Everyone may change, or that Administrators, SYSTEM and TrustedInstaller do not own (for example one an old installer left behind), is refused. Delete the folder or correct its permissions and try again.
* **Protected setup files need `--key-file` when run silently.** The elevated copy is sure to get the arguments, but the `BACH_ACCESS_KEY` variable may not reach it.
* **Data folders belong to one account.** "Also delete my data" deletes the data folders of the account that runs the uninstaller, because `%APPDATA%` and `%LOCALAPPDATA%` belong to one user.
* **Do not change `scope` after your first release.** An app installed per user and one installed machine-wide are two installs to Windows, so an update with the other scope installs next to the old one instead of replacing it.
* **Run steps need no second prompt.** Setup is elevated already, so a [`[[run]]`](/docs/reference/config/run) step that needs administrator rights, like the Visual C++ redistributable, just runs.
* **Services and firewall rules need this scope.** [`[[services]]`](/docs/reference/config/services) and [`[[firewall]]`](/docs/reference/config/firewall) install with administrator rights, so they work only with `installer.scope = "machine"`. Drivers are not built in: a `[[run]]` step can start a program that installs one.

## Elevate one step only

If only one program needs administrator rights, keep the install per user and mark that step:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[[run]]
name = "Visual C++ runtime"
file = "redist/vc_redist.x64.exe"
arguments = "/quiet /norestart"
success_codes = [0, 1638, 3010]
when = "first_install"
elevated = true
```

Windows asks once when that step starts. See [`[[run]]`](/docs/reference/config/run) for what an elevated step may do and why to keep it to well-known installers.

## Check what you built

`bach inspect` on the setup file shows `Installs to  %ProgramFiles%\<folder>` and `For  every user of the computer (asks for administrator rights once)`. `bach preview` opens the window without asking for administrator rights and installs nothing.

See the [`[installer]`](/docs/reference/config/installer) reference, [Files and locations](/docs/reference/setup/files-and-locations.md) and the [safety rules](/docs/concepts/safety.md).


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