added use of wt if available in winutil standalone script

Credits: #2565
This commit is contained in:
psyirius 2024-08-21 03:04:56 -07:00
parent 77c5a158f5
commit de3657adfa

View File

@ -39,7 +39,15 @@ param (
"-NoProfile", # Don't load PowerShell profile
"-File", $MyInvocation.MyCommand.Source, # Script path
$args | ForEach-Object { $_ } # Script arguments
) | ForEach-Object { "`"$_`"" }
)
if ($Debug) {
$PwshArgList = @(
"-NoExit" # Don't exit after running the command
) + $PwshArgList
}
$PwshArgList = $PwshArgList | ForEach-Object { "`"$_`"" }
$WorkingDirectory = Get-Location
@ -51,6 +59,17 @@ param (
PassThru = $true;
}
# Use 'wt' if available
if (Get-Command "wt" -ErrorAction SilentlyContinue) {
$WtArgList = @(
"new-tab",
$ProcessParameters.FilePath
) + $PwshArgList
$ProcessParameters.FilePath = "wt.exe"
$ProcessParameters.ArgumentList = $WtArgList
}
$process = $null
try {
$process = Start-Process @ProcessParameters