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

# Make your first installer

> Follow every step from a finished app to a working Setup.exe: install Bach, create bach.toml, check it, preview the window, build and test it.

In this tutorial you take a small Windows app and turn it into a `Setup.exe` that installs it, with a Start menu shortcut and an uninstaller. It takes about five minutes. If you have your own app, use it. If you don't, the first step makes a tiny one.

You need:

* A Windows computer. The `bach` command also runs on macOS and Linux, but the preview and the test install here need Windows.
* Bach installed. If you haven't done that, follow [Install Bach](/docs/installation.md) and check that `bach --version` prints a version number.

## 1. Get an app into a folder

Bach packages an app that's already built. For this tutorial the project looks like this:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
hello-notes/
  build/
    hello-notes.exe     the program
    welcome.txt         a file the program ships with
```

If you have your own app, make a folder like this with your files in `build`, and replace the names in the steps below with yours. The [framework guides](/docs/guides/prepare-your-app.md) say where your tools put the build.

> [accordion] Make the sample app (Windows PowerShell)
>
> Windows can compile a tiny program for you. Open **Windows PowerShell** (the built-in one, version 5.1, not PowerShell 7), go to a folder where you keep projects, and paste this:
>
> ```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}}
> New-Item -ItemType Directory -Force hello-notes\build | Out-Null
> Set-Location hello-notes
>
> $code = @'
> using System;
> using System.Windows.Forms;
>
> public class Program
> {
>     [STAThread]
>     public static void Main()
>     {
>         Application.EnableVisualStyles();
>         var window = new Form { Text = "Hello Notes", Width = 480, Height = 320 };
>         window.Controls.Add(new TextBox { Multiline = true, Dock = DockStyle.Fill });
>         Application.Run(window);
>     }
> }
> '@
> Add-Type -TypeDefinition $code -ReferencedAssemblies System.Windows.Forms -OutputAssembly build\hello-notes.exe -OutputType WindowsApplication
>
> Set-Content -Path build\welcome.txt -Value "Welcome to Hello Notes."
> ```
>
> Run `.\build\hello-notes.exe` and a window with a text box opens. Close it again.

## 2. Create bach.toml

In the `hello-notes` folder (the one above `build`), run:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach init
```

Bach writes a `bach.toml` and prints:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Wrote .\bach.toml. Fill in [app] and [files], then run `bach check`.
Once this is a GitHub repository, run `bach workflow` to add a one-click release.
```

Open `bach.toml` in your editor. Most of it is commented out, with notes about options you can turn on later. The lines that matter now are these:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[app]
name = "Hello Notes"
version = "1.0.0"
publisher = "Hello Notes"
# The program to start, inside the files folder below.
executable = "hello-notes.exe"

[files]
# Everything in this folder is installed. Build your app into it first.
source = "build"
```

Bach guessed the name from the folder. Change `publisher` to your name or company, then save:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
publisher = "Your Name"
```

For your own app, also check that:

* `executable` is the file name of your program inside the build folder
* `source` is the path of your build folder, relative to `bach.toml`

The second line of the `bach init` message is about releasing from GitHub, which you can ignore for now. In a folder that's already a GitHub repository, `bach init` also adds a release workflow and turns on [automatic updates](/docs/guides/automatic-updates.md); delete the `[updates]` section if you don't want that yet.

## 3. Check it

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach check
```

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Hello Notes 1.0.0 is ready to build.
  Publisher    Your Name
  Program      hello-notes.exe
  Files        2 (4.0 KB)
  Installs to  %LOCALAPPDATA%\Programs\Hello Notes
  Options      desktop shortcut (offered, ticked), Start menu
  Languages    all 19 (follows Windows)
  Look         bach style, follows Windows' light or dark

      4.0 KB  hello-notes.exe
    28 bytes  welcome.txt
```

This tells you what the installer will do, and lists every file it will install. If something is wrong, you get one sentence naming the setting instead. Fix it and run `bach check` again.

## 4. Preview the window

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach preview
```

The install window opens with the heading **Install Hello Notes**, the install location, a desktop shortcut option and an **Install** button. It's the real window with every step pretended, so you can click **Install** and nothing happens to your computer. Close it when you're done.

## 5. Build the setup file

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build
```

At the end you see something like:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Wrote dist\Hello Notes-Setup-1.0.0.exe (9.3 MB)
  Packed       1.5 KB of 4.0 KB (38%), in 0.6s
```

Your setup file is in the new `dist` folder:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
hello-notes/
  bach.toml
  build/
  dist/
    Hello Notes-Setup-1.0.0.exe    this is what you give to people
```

Most of its 9 MB is the install window itself; your app is packed inside.

## 6. Test it

> [!NOTE]
>
> Running the setup file really installs the app on this computer. It's harmless for this sample, and you remove it again at the end.

1. Double-click `Hello Notes-Setup-1.0.0.exe` in the `dist` folder.
2. Click **Install**. The window says **Hello Notes is installed**.
3. Click **Open Hello Notes**, and the app starts.

Other people who download your file may first see **Windows protected your PC**, because it isn't [signed](/docs/guides/signing.md). They can click **More info**, then **Run anyway**.

Check what it did:

* The app is in `%LOCALAPPDATA%\Programs\Hello Notes` (paste that path into File Explorer's address bar), next to an `uninstall.exe`.
* **Hello Notes** is in the Start menu and, unless you unticked it, on the desktop.
* It's listed under **Settings › Apps › Installed apps**.

Now remove it: in **Settings › Apps › Installed apps**, find Hello Notes and choose **Uninstall**.

## What you have now

You have one file that installs your app on Windows 11 and on Windows 10 version 1809 or newer, without an administrator password. Keep `bach.toml` with your project; every release is `bach build` again.

## Next steps

* [Understand bach.toml](/docs/guides/write-bach-toml.md)
* [Make the window yours](/docs/guides/customize-the-window.md): logo, colors, languages, license
* [Ship an update](/docs/guides/first-update.md)
* [Sign your setup file](/docs/guides/signing.md) to avoid the Windows warning
* [Publish releases from GitHub](/docs/guides/releasing.md)


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