prevent “abort” in windows batch for npm install

2019-03-23 07:08发布

问题:

I am writing a bat file to auto install npm packages and install compass. The bat is simple as below:

npm install -g bower
npm install -g grunt-cli
npm install
gem update --system --verbose
gem install compass --verbose
pause

I find that after each command, the bat file auto aborts and won't run next command. How can I make this simple script run continuously and able to re-run many times?

回答1:

Possibly the npm program is a batch file itself.
Then you need to use call, as only then the program control returns to the caller.

call npm install -g bower
call npm install -g grunt-cli
call npm install
call gem update --system --verbose
call gem install compass --verbose
pause