George Edwards
George Edwards

Reputation: 9229

How to launch cmd running a command from powershell

I want to write a powershell script that sets up a development environment. Firstly, I want to launch two command prompts which are running yarn run dev:client and yarn run dev:server respectively.

I have tried start cmd and Start-Process cmd -Argument yarn,run,dev:server, but am unable to get the newly launched command prompt to run the command.

How do I do this?

Upvotes: 2

Views: 9178

Answers (2)

bergmeister
bergmeister

Reputation: 969

The generic way is: cmd /c "insert_your_command_here"

This means in your case you would execute:

cmd /c "yarn run dev:client"
cmd /c "yarn run dev:server"

Upvotes: 1

user2304458
user2304458

Reputation: 387

What about:

$arg="run dev:server"
Start-Process -FilePath path_to_yarn  -Args $arg -passthru -RedirectStandardError err.log

Upvotes: 0

Related Questions