Skip to main content
A Windows service is a program that runs in the background without anyone signed in, such as a sync agent or a local server. [[services]] installs one. Because that needs administrator rights, it requires installer.scope = "machine".
bach.toml
Your program has to be written as a Windows service; Bach doesn’t wrap ordinary programs.

During setup

  • First install: services are created, and auto or delayed ones started. One that doesn’t start within 30 seconds fails the install, which is then undone.
  • Update: running services are stopped (up to 30 seconds), files replaced, definitions updated, and services started again if they were running or start says so. Services no longer listed are removed. A failure restores the previous version.
  • Removal: services are stopped and deleted before the files. A problem here is logged but doesn’t stop removal.
Setup only changes a service whose program is in your install folder. If a service with that name already exists for something else, the install fails and the log names it. bach build --msi refuses apps with services. bach inspect and bach diff show them. On macOS, use [[macos.agents]].