From a49a37949b0f8a1298685fbafab0d138f4561702 Mon Sep 17 00:00:00 2001 From: Mark Iannucci Date: Fri, 30 Apr 2021 13:31:12 -0600 Subject: [PATCH] document how to start windows terminal and have it execute a command (#298) * document how to start windows terminal and have it execute a command #296 * Separated the argument examples and included explanations of what they accomplish * fix typo * remove version from url Co-authored-by: Mark Iannucci Co-authored-by: Matt Wojciakowski --- TerminalDocs/command-line-arguments.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/TerminalDocs/command-line-arguments.md b/TerminalDocs/command-line-arguments.md index f81cac9d..d002eaea 100644 --- a/TerminalDocs/command-line-arguments.md +++ b/TerminalDocs/command-line-arguments.md @@ -55,6 +55,22 @@ Below is the full list of supported commands and options for the `wt` command li Commands may vary slightly depending on which command line you're using. +### Passing an argument to the default shell + +To start an instance of Windows Terminal and have it execute a command, call `wt.exe` followed by your command. + +Here's an example of calling Windows Terminal to pass a [ping](https://docs.microsoft.com/windows-server/administration/windows-commands/ping) command argument to echo an IP address: + +```powershell +wt ping docs.microsoft.com +``` + +Here's an example of calling Windows Terminal to open a new tab with a PowerShell command line, confirming to call the [Start-Service](https://docs.microsoft.com/powershell/module/microsoft.powershell.management/start-service) command, and opening another new tab with Windows Command Prompt open to the `/k` directory: + +```cmd +wt new-tab PowerShell -c Start-Service ; new-tab cmd /k dir +``` + ### Target a specific window > [!IMPORTANT]