Q:

How to run multiple processes in separate windows simultaneously from a single PS1 file?

I asked this question and got it working. Being a lazy type, I thought that I could automate the starting process as well. I got the following doing the stuff for me.
function GoToWorkApi{
  cd C:\Source\...\api
  git pull
  code .
  dotnet run
  dir
}

function GoToWorkWeb{
  cd C:\Source\...\web
  code .
  npm run dev
  dir
}

Now, I'm even more lazy than that and I've tried to put those two in a single file by working Start-Process command. It seems that it gets "stuck" on the dotnet run part.
function GoToWork{
  cd C:\Source\...\api
  git pull
  code .
  dotnet run

  cd C:\Source\...\web
  code .
  npm run dev
}

I'm sensing that I need to open a new PowerShell window and run the individual scripts separately but I haven't got it under controll. How do I do that?
Googlearching leads me only to Azure related stuff and this is plain desktop.

A:

You should use Start-Process cmdlet instead of dotnet run.
Example:
Start-Process -FilePath 'dotnet' -ArgumentList 'run'
...
Start-Process -FilePath 'npm' -ArgumentList 'run dev'

is it possible to control the opened window's colors

Not sure if you can control it through PS. All that comes to my mind is: Start-Process -FilePath cmd.exe -ArgumentList '/k color 71 & your_command_here'.

