Skip to main content
An environment variable is a named value that programs can read. [[env]] sets one during install, for example so scripts can find your tool. Each block is one variable, set for the user, or for the computer with a machine-wide install.
bach.toml

The name prefix

The app id in capitals, with other characters as _: Hello gives HELLO_, Hello Notes gives HELLO_NOTES_. This stops one app from overwriting another’s variables. To set a name that other programs read, add allow = true; Bach warns about it.

Refused names

  • Windows’ own variables such as PATH, PATHEXT, TEMP, TMP, USERPROFILE, APPDATA, LOCALAPPDATA, SYSTEMROOT, WINDIR and PROCESSOR_*, and Bach’s BACH_*. For PATH, use add_to_path.
  • Variables that load code into other programs or redirect their network traffic, even with allow: for example COR_PROFILER and other COR_* and CORECLR_* settings, DOTNET_STARTUP_HOOKS, JAVA_TOOL_OPTIONS, NODE_OPTIONS, PYTHONPATH, HTTP_PROXY, HTTPS_PROXY, SSL_CERT_FILE and LD_PRELOAD.

Behavior

Programs started after the install see the new variable; running programs don’t. Updates remove variables the new version no longer lists. Uninstalling removes a variable only while it still has the value setup gave it. bach inspect shows them as Variable. Windows only.