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

# Uninstalling and user data

> What the uninstaller removes and keeps, how to let users delete their app data, which folders are allowed, and how quiet removal works.

Every install adds an `uninstall.exe` to the install folder and an entry under **Settings › Apps**. This page explains what removing your app does, and how to offer your users to delete the data your app saved.

## What the uninstaller removes

It removes what the installer added:

* the files it installed
* the shortcuts, the entry under Settings › Apps, and the [Windows integration](/docs/guides/integration.md) such as links, file types and `PATH` entries
* the install folder, if nothing else is left in it

It keeps:

* **Files it didn't install.** If your app or the user created files in the install folder, such as logs or documents, they stay, and so does the folder.
* **Files that were changed after install.** If a user edited a configuration file you shipped, the uninstaller keeps their version and notes it in the log.
* **User data** elsewhere on the computer, unless you list it and the user asks to delete it.

## Offer to delete user data

Apps usually save settings in a folder like `%APPDATA%\Hello Notes`. List those folders:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[uninstall]
data = ['%APPDATA%\Hello Notes', '%LOCALAPPDATA%\Hello Notes']
data_description = "Your notes and settings."
```

The removal window then shows an unticked **Also delete my data** box, with your description and the folder paths. The folders are only deleted if the user ticks it.

Use single quotes around Windows paths, so TOML keeps the backslashes.

### Which folders are allowed

To make sure an uninstaller can never delete someone's documents, each entry must:

* start with `%APPDATA%`, `%LOCALAPPDATA%` or `%USERPROFILE%`
* name a folder of your own after that

Bach refuses, among others, whole user folders such as `Documents` or `Desktop`, anything inside `.ssh`, `.aws` or `Microsoft`, source code folders, other programs' data such as browser profiles, and a whole company folder such as `%APPDATA%\Google`. A folder of your own inside a shared folder is fine, such as `%USERPROFILE%\Documents\My Game`. `bach check` warns if a folder doesn't look like it belongs to your app.

[`[uninstall]`](/docs/reference/config/uninstall) lists every rule.

## Ask why people leave

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[uninstall]
feedback_url = "https://example.com/goodbye"
```

The last page of the removal window shows a **Tell us why** link to this page. It must be an `https` address.

## If the app is running

The uninstaller waits briefly, then stops with **Hello Notes is still open. Close it, then try again.** Nothing is removed in that case.

If a file can't be removed, for example because an antivirus program holds it, everything is put back and the app stays installed and working. If only a data folder can't be deleted, the app is still removed and the last page names the folder.

## Removing from a script

```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}}
$uninstall = "$env:LOCALAPPDATA\Programs\Hello Notes\uninstall.exe"
Start-Process $uninstall -ArgumentList '--silent' -Wait -PassThru
```

Add `--delete-data` to also delete the listed data folders. `Start-Process -Wait` is needed because `uninstall.exe` is a windows program: without it, your script wouldn't wait for it. See [Uninstaller options](/docs/reference/setup/uninstaller.md).

## Run something before removal

If your app registers something that the uninstaller doesn't know about, run your own cleanup program with a [`[[run]]` step](/docs/guides/run-programs) with `when = "uninstall"`.

## Why does uninstall.exe look unsigned?

The uninstaller is created on your user's computer from your setup file, without the signature, because a signature only matches the exact file it was made for.

## Test it

Install your app on a test computer, change a setting in it, then remove it with the box ticked and unticked. `bach preview --uninstall` shows the window without removing anything.


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