简体   繁体   中英

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?

What about:

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM