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

# [[migrate]]: remove an older install

> Reference for [[migrate]] in bach.toml: remove an older Inno Setup, NSIS or MSI install of your app before a first install, without ever stopping the install.

`[[migrate]]` names an older install of your app that another installer made. A first install with Bach removes it before it places any file, using the uninstall command that Windows already holds for it under Settings › Apps. Without it, an app that moves to Bach would sit on each upgraded computer twice.

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[[migrate]]
uninstall_key = "{8A69D345-D564-463C-AFF1-A69D9E530F96}_is1"   # Inno Setup: your AppId, then _is1

[[migrate]]
uninstall_key = "Hello"          # NSIS: the key your script wrote under Uninstall
arguments = "/S"                 # quiet switch, when the entry has no QuietUninstallString

[[migrate]]
uninstall_key = "{3F2504E0-4F89-11D3-9A0C-0305E82C3301}"   # an MSI: its product code
```

| Setting | Default | Meaning |
| - | - | - |
| `uninstall_key` | required | The name of the old install's entry under `Software\Microsoft\Windows\CurrentVersion\Uninstall`, in the user's or the computer's registry (the 32-bit view too). Inno Setup writes `<AppId>_is1`, an MSI its product code, NSIS whatever name your script chose. Look it up with `regedit`. |
| `arguments` | none | Arguments that make the old uninstaller run without a window, added after its `UninstallString`: `/VERYSILENT /NORESTART` for Inno Setup, `/S` for NSIS. Without them setup uses the entry's `QuietUninstallString`, and with neither it leaves the old install alone. An MSI is always removed quietly with `msiexec /x {code} /qn /norestart`. |
| `elevated` | `false` | Also remove an old install that is machine-wide (listed under `HKLM`). Windows asks for administrator rights. Without it, setup leaves a machine-wide old install alone. |

## What setup does

* It runs on a **first** install only, before any file is placed, so nothing the old uninstaller deletes can be a file Bach just installed. The progress label is the text `step_migrating`.
* It runs only the command in that entry, never through a shell, and only if it is an absolute path to an `.exe` that exists. It waits for the old uninstaller (up to 15 minutes) and then until its entry is gone from Settings › Apps (up to 90 seconds), because some uninstallers hand over to a copy of themselves and exit at once.
* It never stops an install. An old install that is not there, cannot be removed silently or fails to go is written to the log (`%TEMP%\<app id>-setup.log`) and left alone, and the new version installs anyway.
* It does not touch the user's data. The old uninstaller decides what it removes, and most keep settings. Keep `uninstall.data` pointed at the folders the old app used so the new version finds them.

## What may run with administrator rights

The command comes from the registry, so what may run elevated is limited.

* A per-user old install (under `HKCU`, which the user's own programs can write) is never run by an elevated setup, such as a [machine-wide install](/docs/guides/machine-wide-installs.md).
* A machine-wide old install (under `HKLM`) runs only with `elevated = true`, or when setup is elevated already, and only if its uninstaller sits in Program Files or the Windows folder.
* `%SystemRoot%` and `msiexec` come from Windows, not from environment variables.
* Anything else is left alone, with a line in the log.

See [Move from another installer](/docs/guides/migrate-from-another-installer.md) for a walkthrough. `bach inspect` lists each entry as `Replaces`.


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