# LibTmux\New-TmuxCommand

- **Package:** LibTmux
- **Language:** PowerShell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/src/LibTmux.PowerShell/NewTmuxCommandCommand.cs#L6
- **Page:** https://libtmux.org/en/powershell/latest/reference/libtmux-new-tmuxcommand/

```
New-TmuxCommand
    [-Name] <System.String>
    [[-Arguments] <System.String[]>]
    [<CommonParameters>]
```

Construct a native tmux command without running it.

[`Create`](/en/csharp/latest/reference/libtmux-tmuxcommand-create/) one native [`TmuxCommand`](/en/csharp/latest/reference/libtmux-tmuxcommand/) with literal argument boundaries. Construction
performs no tmux I/O, starts no shell and copies the supplied string array.
Empty strings remain arguments; null and NUL-containing arguments are rejected.

Use this value with [`Invoke-TmuxChain`](/en/powershell/latest/reference/libtmux-invoke-tmuxchain/) or [`Invoke-TmuxControlCommand`](/en/powershell/latest/reference/libtmux-invoke-tmuxcontrolcommand/). Values
returned by native typed requests can be passed directly to those commands;
reconstructing a typed request as raw text would discard its identity guards.

### Notes

[`Tmux.InvalidCommand`](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/New-TmuxCommand.md#notes) terminates invalid construction before any tmux I/O.

## Command details

- **Command type:** [`cmdlet`](/en/powershell/latest/reference/glossary/#cmdlet)
- **Positional binding:** Enabled.
- **Pipeline inputs:** `None`: No pipeline input.
- **Outputs:** `LibTmux.TmuxCommand`

Related APIs:

- [Commands and control clients](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/commands.md)

## Examples

Example 1

Construct a command that prints text containing spaces and punctuation.

[Source example](https://github.com/libtmux/libtmux-powershell/blob/b06c64f844f3173de66b187eaeaf3915814318c6/docs/reference/LibTmux/New-TmuxCommand.md).

```powershell
LibTmux\New-TmuxCommand -Name 'display-message' -Arguments @(
    '-p', 'hello; tmux'
)
```

## Parameters

- `Name` (`System.String`): A tmux command name or alias. Empty, whitespace, NUL and leading global options are rejected.
  Required. Position 0. Does not accept pipeline input. [`ValidateNotNullOrEmpty()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnulloremptyattribute?view=powershellsdk-7.4.0).
- `Arguments` (`System.String[]`): Literal command arguments. The default is an empty array.
  Optional. Position 1. Does not accept pipeline input. [`ValidateNotNull()`](https://learn.microsoft.com/dotnet/api/system.management.automation.validatenotnullattribute?view=powershellsdk-7.4.0).
- `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`.

## Returns

`LibTmux.TmuxCommand`: A native command value; no execution result.
