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

# bach choco: write the Chocolatey package

> bach choco FILE --url URL: writes a Chocolatey package for a Bach setup file, with a nuspec and install and uninstall scripts that check the SHA-256 first.

`bach choco` writes the Chocolatey package that installs a setup file: a `.nuspec`, an install script that downloads the setup file, checks its SHA-256 and runs it with `--silent`, and an uninstall script that runs the app's own uninstaller.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach choco dist/Hello-Setup-1.4.0.exe --url https://example.com/Hello-Setup-1.4.0.exe --license MIT
```

| Argument or flag | Meaning |
| - | - |
| `FILE` | The setup file. An online installer or an uninstaller is refused. |
| `--url URL` | Required. The `https` link the setup file is downloaded from. |
| `--license TEXT` | The app's license: a link, or a name like `MIT` (written as `https://spdx.org/licenses/MIT.html`). Without it the package has no license and a warning says so. |
| `--out DIR`, `-o DIR` | Write the package into this folder. Default: `choco/<id>/<version>` next to the setup file. |

## Output

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Wrote the Chocolatey package for hello 1.4.0 to <folder>
Build it with `choco pack` in that folder, then test it with `choco install hello --source .`.
```

The folder holds `<id>.nuspec`, `tools/chocolateyInstall.ps1` and `tools/chocolateyUninstall.ps1`. The package id is the app id in lowercase, with every other character turned into `-`. The install script carries the SHA-256 of the file you gave (`checksum64`, or `checksum` for an x86 runtime), so Chocolatey refuses a download that differs. The uninstall script finds the app under `Settings › Apps` by its app id, in `HKLM` and `HKCU`, and runs its uninstaller with `--silent`.

> [!WARNING]
>
> Chocolatey runs as an administrator, so a per-user app (the default) is installed for that account only. Set [`installer.scope = "machine"`](/docs/guides/machine-wide-installs) to install for every user. `bach choco` warns for the other apps. It refuses a version that NuGet does not accept (like `1.2.3` or `1.2.3-beta` are), and warns that an ARM64 setup file is listed as the 64-bit download, because Chocolatey has no ARM64 field.

Publish the `.nupkg` that `choco pack` makes to your own feed or to the Chocolatey community repository.

See also [`bach winget`](/docs/reference/cli/winget).


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