Reputation: 4896
I'm using a bat file to run my nodejs app in windows 7. The bat file contains following lines,
cd "C:/dev/nodeapp/"
npm start
pause
But the bat file doesn't pause. Because of that I can't see the errors on cmd when nodejs throws errors. I tried cmd /k
instead of pause
, it doesn't work either.
Anybody knows a way to pause the bat file execution here?
I notice that the problem is with the line npm start
. When I remove that line the pause
works..!
Thank you in advance...
Upvotes: 1
Views: 1624
Reputation: 70923
It does not pause because in windows npm
is a batch file (npm.cmd
). Directly invocation of a batch file from inside a batch file transfers the execution to the called one, and does not return to the caller. You need to use call
command
cd "C:/dev/nodeapp/"
call npm start
pause
Upvotes: 5