# window.Window.cmd

- **Module:** window
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/window.ts#L565
- **Page:** https://libtmux.org/en/ts/latest/reference/window-window-cmd/

```
cmd(
  command: string,
  args: readonly string[] = [],
  options?: CmdOptions,
): Promise<readonly string[]>
```

Run a tmux command this package does not model, addressed at this window.

The window's id is sent as the target; pass `target` to address something
else, or [`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null) for a command that takes none — [`display-panes`](/en/tmux/latest/manual/display-panes/) takes a
client, so it wants `{ target: `[`null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null)` }` and not this window's `@n`.

## Examples

```ts
await window.cmd("rotate-window");
```

## Parameters

- `command` (`string`)
- `args` (`readonly string[]`)
  Default: `[]`.
- `options?` (`CmdOptions`)

## In other ports

Run a tmux command addressed at a window

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.cmd`](/en/py/latest/reference/libtmux-window-cmd/) (method) |
| Rust | [`window.Window.cmd`](/en/rs/latest/reference/window-window-cmd/) (method) |
| Go | [`tmux.Window.Cmd`](/en/go/latest/reference/tmux-window-cmd/) (method) |
| Java | no equivalent on `Window` |
| C# | no equivalent on `Window` |
| C++ | no equivalent on `Window` |
| Swift | no equivalent on `Window` |

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Elixir, Kotlin, Scala or F#.
