# server.Server.batch

- **Module:** server.Server
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/server.ts#L1028
- **Page:** https://libtmux.org/reference/ts/server-server-batch/

```
server.Server.batch(operations: : T, options: : CommandOptions) -> Promise<{ -readonly [K in keyof T]: T[K] extends PlannedOperation<infer R> ? R : never; }>
```

Run planned mutations in order, resolving each to what it made.

The batched form of calling them one at a time: the same options go in and
the same handles come out, positionally and individually typed. Calling
`newWindow` repeatedly takes one snapshot after each mutation; a batch runs
the mutations in order and resolves all of them from one final snapshot.

Not atomic, for the same reason {@link Server.pipeline} is not: tmux runs
them in order and stops at the first failure, leaving everything before it
applied.

## Example

```ts
const [editor, logs] = await server.batch([
  session.plan.newWindow({ name: "editor" }),
  session.plan.newWindow({ name: "logs" }),
]);
```
