0

I'm using a zen command shown below to navigate to my project and open a new window. The first one is used for GIT'ing and general stuff for the whole solution. The second is specific to the SPA'ing and tasks specific to the front-end.

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
}

I would like to execute additional calls in the window that opens second. Let's say I'd like to run the following commands in it and prefer not to wear out my fingers by typing it manually each time I reopen the working environment.

code .
ng serve

Is it possible to do at all? How? What to google for?

1 Answer 1

1

Use the Start-Process -ArgumentList argument to run your commands. Include the -noexit argument to leave the new PowerShell environment open.

Start-Process PowerShell -WorkingDirectory $path -ArgumentList "-noexit", "code .", "ng serve"
Sign up to request clarification or add additional context in comments.

1 Comment

It's very interesting that I don't need to use the argument -noexit when running the argumentless version as shown in my question but I have to add it if I'm providing other arguments to the command. Comment on that? (At any rate - great answer. It works and explains while still brief. +1 for that.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.