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

# [[env]]: set environment variables

> Reference for [[env]] in bach.toml: set user environment variables, with the install folder as {app}, and remove them only while they still hold your value.

`[[env]]` sets environment variables when the app is installed. A per-user install sets them for the user (`HKCU\Environment`), a [machine-wide install](/docs/guides/machine-wide-installs.md) for the computer. Programs started after the install see them; programs that are already running do not.

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[[env]]
name = "HELLO_HOME"
value = '{app}'                 # {app} is the install folder
# allow = true                  # only for a name that does not start with HELLO_
```

| Setting | Meaning |
| - | - |
| `name` | Letters, digits and `_`, not starting with a digit, up to 128 characters. It must start with the app id in capitals, every other character turned into `_`: `Hello` gives `HELLO_`, `My App` gives `MY_APP_`. |
| `allow` | `true` lets the name differ from that prefix, so a variable other programs read can be set on purpose. `bach check` warns about it. Default `false`. |
| `value` | The value, up to 4096 characters. `{app}` stands for the install folder. |

## What setup does

* A value with a `%VARIABLE%` in it is stored so Windows fills it in when it is read.
* An update takes back variables the new version no longer lists.
* Removing the app removes a variable only while it still holds the value setup set.
* Names that Windows uses are refused: `PATH`, `PATHEXT`, `TEMP`, `TMP`, `USERPROFILE`, `APPDATA`, `LOCALAPPDATA`, `SYSTEMROOT`, `WINDIR` and the like, `PROCESSOR_*` and `BACH_*`. `PATH` has its own setting, `add_to_path`, in [`[installer]`](/docs/reference/config/installer).
* Variables that load code into other programs or redirect their traffic are refused whatever `allow` says: the `COR_*` and `CORECLR_*` profiler settings, `DOTNET_STARTUP_HOOKS`, `JAVA_TOOL_OPTIONS`, `_JAVA_OPTIONS`, `NODE_OPTIONS`, `PYTHONSTARTUP`, `PYTHONPATH`, `PERL5OPT`, `HTTP_PROXY`, `HTTPS_PROXY`, `NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, `SSLKEYLOGFILE`, `LD_PRELOAD` and a few more.
* A name can be set only once.
* `bach inspect` lists each variable as `Variable`.


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