> ## 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 options and optional components

> Let users choose shortcuts, autostart or PATH, and which optional parts of your app to install. Learn the four option values and how updates keep them.

The install window can ask your users a few questions: do they want a desktop shortcut, should the app start with Windows, do they want the sample projects? This page explains how you decide which questions appear and what happens to the answers.

## Built-in options

These are settings under `[installer]`:

| Setting | What it does | Default |
| - | - | - |
| `desktop_shortcut` | Puts a shortcut on the desktop | `true` |
| `start_menu_shortcut` | Puts a shortcut in the Start menu | `"always"` |
| `start_with_windows` | Starts the app when the user signs in | `"never"` |
| `add_to_path` | Lets users run your program by name in a terminal | `"never"` |

Each takes one of four values:

| Value | What the user sees | What happens |
| - | - | - |
| `true` | A ticked box | Done unless they untick it |
| `false` | An empty box | Done only if they tick it |
| `"always"` | Nothing | Always done |
| `"never"` | Nothing | Never done |

For example, a chat app that suggests starting with Windows, without forcing it:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[installer]
desktop_shortcut = false
start_with_windows = true
```

With `[updates]`, there's also an **Automatic updates** box, controlled by [`updates.auto`](/docs/reference/config/updates).

`add_to_path` adds your install folder to the user's `PATH`. If your command-line tools are in a subfolder, set `path_folder`:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[installer]
add_to_path = "always"
path_folder = "bin"
```

Bach adds or removes exactly one `PATH` entry and leaves the rest unchanged.

## Optional components

A component is a part of your app that users can leave out. Each one appears as a box in the install window.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
build/
  hello-notes.exe     always installed
  samples/            optional
    meeting.md
```

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[[components]]
id = "samples"
title = "Sample notes"
description = "A few notes to look around in."
files = ["samples/**"]
default = true
```

* `id` is a short name in lowercase. Silent installs use it: `--with samples` or `--without samples`.
* `title` and `description` are what the user reads. They can be [translated](/docs/reference/config/components.md).
* `files` are [patterns](/docs/guides/choose-files.md#leave-files-out) relative to `files.source`.
* `default = true` means the box starts ticked. The default is unticked.

Files that no component claims are always installed. Your main program can't be part of a component.

## What happens on updates

The window remembers what each user chose. When they update:

* Boxes start the way they left them.
* A new component starts at its `default`.
* Unticking a component removes its files and any shortcut to them.

## Download a component only when it's wanted

Large optional parts, such as texture packs or language models, can stay out of the setup file and be downloaded when someone ticks them:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[updates]
github = "your-name/hello-notes"

[[components]]
id = "textures"
title = "HD textures"
files = ["textures/**"]
download = true
```

`bach build` then writes the component into its own file next to the setup file, such as `Hello-Notes-textures-1.0.0.bachpack`. Upload it with your release, to the same place as your setup file. `download = true` uses the download link from `[updates]`; you can also give a full `https` link. The setup file checks the downloaded file against a checksum recorded when you built it.

Downloaded components can't be combined with an [access key](/docs/guides/paid-apps.md) that encrypts files.

## A file that needs two components

By default, a file matched by several components belongs to the first one. If you want a file installed only when all of them are ticked, set:

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

[[components]]
id = "tools"
title = "Tools"
files = ["vendor*/tools/**"]

[[components]]
id = "vendor1"
title = "Vendor 1"
files = ["vendor1/**"]
default = true
```

Here `vendor1/tools/...` is installed only if both **Tools** and **Vendor 1** are ticked. This needs Bach 0.11.1 or newer. [`[[components]]`](/docs/reference/config/components#files-that-need-several-components) lists all the rules.

## Try it

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

Tick and untick the boxes. Preview installs nothing. To see which files belong to which component, run `bach check`: the component's id appears next to each file.


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