如何在 PowerShell 中打开新控制台然后在其中执行某些操作?

How to open new console in PowerShell AND THEN execute something in it?

我正在使用如下所示的 zen 命令导航到我的项目并打开一个新的 window。第一个用于 GIT'ing 和整个解决方案的一般内容。第二个是特定于前端的 SPA'ing 和任务。

function Dev-Zen-Mrr{
  Dev-Init
  Set-Location "dev/mrr"      
  Dev-Window "web/ClientAppAutonomous/clientapp"
}

function Dev-Window{
  param([string]$path = " ")
  Start-Process PowerShell -WorkingDirectory $path
}

我想在第二个打开的 window 中执行其他调用。假设我想 运行 在其中输入以下命令,并且不想在每次重新打开工作环境时都手动输入它来耗尽我的手指。

code .
ng serve

有可能吗?如何? google 有什么用?

Start-Process -ArgumentList 参数用于 运行 您的命令。包含 -noexit 参数以使新的 PowerShell 环境保持打开状态。

Start-Process PowerShell -WorkingDirectory $path -ArgumentList "-noexit", "code .", "ng serve"