Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use Powershell Core and Microsoft Terminal to open node and dotnet application side-by-side.
param (
$shellName = 'pwsh'
)
$commands = @(
[PSCustomObject]@{
Path = 'my-node-project'
Command = 'npm.cmd start'
Window = 'new-tab'
}
[PSCustomObject]@{
Path = 'my-dotnet-project'
Command = 'dotnet.exe watch run'
Window = 'split-pane'
}
)
$argList = $commands |
ForEach-Object {
$cmd = $_
$fullPath = Join-Path $PSScriptRoot $cmd.Path -Resolve
@(
$cmd.Window
"-p $shellName"
"-d $fullPath"
"pwsh -noexit -command $($cmd.Command)"
) -join " "
} |
Join-String -Separator " ; "
Start-Process -FilePath "wt.exe" -ArgumentList $argList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment