Skip to main content
Every Bach install leaves an uninstall.exe in the install folder and an entry in Settings › Apps. The uninstaller removes only what the install put there. User data is different: it is deleted only when the user asks, and only inside their own profile. This page shows how to configure that and what the uninstaller does.

Offer to delete user data

bach.toml
  • data lists the folders where your app keeps its data. The removal window offers an unticked Also delete my data box and deletes those folders only if the user ticks it.
  • Each folder must start with %APPDATA%, %LOCALAPPDATA% or %USERPROFILE%, followed by your app’s own folder, so the uninstaller can only ever delete inside the user’s profile.
  • A profile folder itself (Documents, Desktop, Downloads, OneDrive, AppData, AppData\Roaming, AppData\Local, Temp and the like) is refused, and so is anything inside .ssh, .aws, .azure, .gnupg, .kube, .docker, .terraform or Microsoft, a tool or work folder directly in the profile (.config, .git, .vscode, .npm, .cargo, source, repos, projects, code and the like), another program’s data (Google\Chrome, Mozilla\Firefox, Code, Discord, Slack, Dropbox), a whole company’s folder (Google, Adobe, JetBrains, …) and NTUSER.DAT. A folder inside one of the shared profile folders, such as %USERPROFILE%\Documents\My Game, is fine. bach check names the setting that breaks the rule, and warns when none of a folder’s parts looks like your app’s name, id or publisher. The uninstaller also skips a folder that is, or contains, the install folder.
  • data_description says in a few words what lives there. It is shown under the checkbox, which also lists the folders themselves as they are on that computer, so nobody has to take the description on trust. It can be text or one text per language.
  • feedback_url is an https page the last page links to as “Tell us why”.
Write Windows paths in TOML with single quotes so backslashes stay as they are: data = ['%APPDATA%\My App'].

What removal does

Settings › Apps runs uninstall.exe. A running program cannot delete its own file, so it copies itself to the temp folder, starts the copy and exits. The copy shows the window and removes, in this order:
  1. The program first. If the app is still open, nothing has changed yet.
  2. Every file the manifest lists, and the folders they leave empty. A file whose SHA-256 no longer matches the manifest, because someone changed it after setup wrote it, is kept and noted in the log.
  3. The shortcuts and the Apps entry.
  4. Start with Windows, the PATH entry, link schemes and file types, each only if it is this install’s own.
  5. The data folders, only if the user ticked the box.
  6. The install folder, only if it is empty, so files a user kept there stay.
Removal is all or nothing. Setup first renames every file to <name>.bach-old; if one cannot move (a locked DLL, security software), the others go back, the message names the file, and the app keeps working and stays registered. If a later step fails, the files, the shortcuts, start with Windows, the PATH entry, link schemes and file types come back too. Only after the app is unregistered are the renamed files and then the shortcuts deleted. A data folder that cannot be deleted (a program or a virus scanner holds a file in it) no longer stops the rest of the removal: it is logged, named on the last page, and the app is gone. Then a hidden helper deletes the temp copy once it has exited.

Quiet removal

Settings › Apps can run a quiet removal, and so can your scripts:
uninstall.exe is a windowed program, so Start-Process -Wait -PassThru is what waits for it and gives you the exit code. See Silent installs. A silent removal works in place instead of handing over to a temp copy, so whoever started it can wait for its exit code. Add --delete-data to delete the user’s data too.
The uninstall.exe an install leaves behind is unsigned by design. It is written on the user’s computer from the signed setup file without the signature, because a signature only covers the exact file it was made for.

Safety guarantees

  • The uninstaller deletes only files listed in its manifest, inside a folder that is verifiably the app’s install, plus data folders the user opted into.
  • It refuses a folder that does not hold the app.
  • Data folders must sit inside the user’s profile and name a folder of their own.
See Safety rules for the full list.