From 7f08428442bd7f36b64bfab3fd5ce2c4e0f8fa31 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 24 Mar 2025 13:57:53 +0100 Subject: [PATCH] Added new-tab.ps1 --- scripts/new-tab.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/new-tab.ps1 diff --git a/scripts/new-tab.ps1 b/scripts/new-tab.ps1 new file mode 100644 index 00000000..4acd942c --- /dev/null +++ b/scripts/new-tab.ps1 @@ -0,0 +1,24 @@ +<# +.SYNOPSIS + Create a new tab in Windows Terminal +.DESCRIPTION + This PowerShell script creates and opens a new tab in Windows Terminal. +.EXAMPLE + PS> ./new-tab.ps1 + ✅ Created a new tab in Windows Terminal. +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz | License: CC0 +#> + +try { + & wt.exe --window 0 new-tab + if ($lastExitCode -ne 0) { throw "Executing wt.exe has failed with exit code $lastExitCode" } + + "✅ Created a new tab in Windows Terminal." + exit 0 # success +} catch { + "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}