I'm trying to script everything. How could I run multiple instances of npm start in one .cmd file for Windows ?
Example : I've got an API which runs with "npm start
" and a client app which also runs with "npm start
". I can easily run a single one with :
cd D:/my folder/...
npm start
But here, i would like to open a second command prompt in order to cd another folder and run another "npm start" with the same .cmd file.
Thank you !
npm is really another batch file, so it should be call
ed. When you call
a batch file from another, it will return to the caller upon completion:
@Echo Off
CD /D "D:\Somewhere"
Call "P:\athTo\npm.cmd" start [-- <args>]
CD /D "C:\AnotherPlace"
Call "P:\athTo\npm.cmd" start [-- <args>]
Rem next line if required goes here
As your question did not require that both commands needed to be run at the same time, (or that a second Command Prompt was a necessity), the answer above is based upon that.