# LibTmux\Rename-TmuxWindow

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/bbab29e574920cd100e4b80688185d91c5d7f877/src/LibTmux.PowerShell/RenameTmuxWindowCommand.cs#L7
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-rename-tmuxwindow/

```
Rename-TmuxWindow
    [-Window] <LibTmux.Window>
    [-Name] <System.String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]
```

Rename a native window and optionally emit its replacement.

Rename the supplied native [`LibTmux.Window`](/en/csharp/latest/reference/libtmux-window/). The endpoint and daemon generation come
from that handle, so the window is named by its ID and not by its old name.
Only that window changes.

With PassThru, return a new [`Window`](/en/csharp/latest/reference/libtmux-window/) handle that carries the new name. The original
handle keeps the name it captured and is stale after the rename. Without
PassThru, emit no success object. tmux expands the name as a format, so a
number sign in it does not survive verbatim. [`WhatIf`](/en/powershell/latest/reference/libtmux-rename-tmuxwindow/#LibTmux%5CRename-TmuxWindow.parameter.WhatIf) performs no tmux I/O.

### Notes

Failures use [`Tmux.WindowRenameFailed`](https://github.com/libtmux/libtmux-powershell/blob/bbab29e574920cd100e4b80688185d91c5d7f877/docs/reference/LibTmux/Rename-TmuxWindow.md#notes) and retain the original core exception, its
dispatch information and the failed owner. [`ErrorAction`](/en/powershell/latest/reference/libtmux-rename-tmuxwindow/#LibTmux%5CRename-TmuxWindow.parameter.ErrorAction) Continue permits later
owners to be processed; [`ErrorAction`](/en/powershell/latest/reference/libtmux-rename-tmuxwindow/#LibTmux%5CRename-TmuxWindow.parameter.ErrorAction) Stop stops on the first failure. A missing
target remains an error. No mutation is retried.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Confirmation:** Supports `-WhatIf` and `-Confirm`; confirm impact: Medium.
- **Positional binding:** Enabled.
- **Pipeline inputs:** `LibTmux.Window`: A native LibTmux.Window selected from an explicit endpoint.
- **Outputs:** `LibTmux.Window`

Related APIs:

- [Create sessions, windows and panes](https://github.com/libtmux/libtmux-powershell/blob/bbab29e574920cd100e4b80688185d91c5d7f877/docs/create.md)
- [Choose endpoints and owners](https://github.com/libtmux/libtmux-powershell/blob/bbab29e574920cd100e4b80688185d91c5d7f877/docs/read.md)

## Parameters

- `Window` (`LibTmux.Window`): The native window to rename. Select it with Get-TmuxWindow on the endpoint you intend to change.
  Required. Position 0. Accepts pipeline input by value. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `Name` (`System.String`): The new window name. An empty name is rejected before tmux is called.
  Required. Position 1. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `PassThru` (`System.Management.Automation.SwitchParameter`): Emit a new Window handle that carries the new name, read back after the rename.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input.
- `Verbose` (`System.Management.Automation.SwitchParameter`): Display verbose messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `vb`.
- `Debug` (`System.Management.Automation.SwitchParameter`): Display debug messages produced by this command.
  Optional. Named parameter. Switch parameter. Common parameter. Does not accept pipeline input. Aliases: `db`.
- `ErrorAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to non-terminating errors.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ea`.
- `WarningAction` (`System.Management.Automation.ActionPreference`): Choose how this command responds to warning messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wa`.
- `InformationAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles information messages.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `infa`.
- `ProgressAction` (`System.Management.Automation.ActionPreference`): Choose how this command handles progress updates.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `proga`.
- `ErrorVariable` (`System.String`): Store the command's error records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ev`.
- `WarningVariable` (`System.String`): Store the command's warning records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `wv`.
- `InformationVariable` (`System.String`): Store the command's information records in the named variable.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `iv`.
- `OutVariable` (`System.String`): Save output in the named variable while passing it down the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ov`.
- `OutBuffer` (`System.Int32`): Buffer output before passing it to the next pipeline command.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `ob`.
- `PipelineVariable` (`System.String`): Make the most recent output object available through a named variable within the pipeline.
  Optional. Named parameter. Common parameter. Does not accept pipeline input. Aliases: `pv`.
- `WhatIf` (`System.Management.Automation.SwitchParameter`): Runs the command in a mode that only reports what would happen without performing the actions.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `wi`.
- `Confirm` (`System.Management.Automation.SwitchParameter`): Prompts you for confirmation before running the cmdlet.
  Optional. Named parameter. Switch parameter. Does not accept pipeline input. Aliases: `cf`.

## Returns

`LibTmux.Window`: With PassThru, one replacement handle for each input. Otherwise no success
objects are emitted.

## Examples

Example 1

Rename the previously selected $window and emit the replacement handle. Assign
the output for subsequent operations.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/bbab29e574920cd100e4b80688185d91c5d7f877/docs/reference/LibTmux/Rename-TmuxWindow.md).

```powershell
$window | LibTmux\Rename-TmuxWindow -Name logs -PassThru
```

## Guides

Pages that discuss `Rename-TmuxWindow`.

- [Create sessions, windows and panes](/en/powershell/latest/guides/create/)
