在一个.bat文件中运行几个grunt任务

use*_*355 9 batch-file gruntjs

是否可以在一个.bat脚本中运行两个grunt任务?

我尝试了以下方法:

grunt --param=val1 --force
grunt --param=val2 --force
Run Code Online (Sandbox Code Playgroud)

但只运行了第一项任务.有任何想法吗?

Fre*_*any 18

Grunt将在结束时退出BAT(不确定原因,但确实如此).为确保即使在grunt退出后仍继续运行,您将需要使用"调用"功能:

call grunt --your-args-here-1
call grunt --your-args-here-2
Run Code Online (Sandbox Code Playgroud)

请注意,如果第一个grunt失败,您仍将运行第二个grunt.我不知道如何解决这个问题,我不需要它,希望^ _ ^

  • Grunt退出是因为grunt是一个批处理文件.在批处理文件中调用批处理文件将终止当前批处理并启动新批处理,除非您在其前面添加"调用".这是一个很好的解释.http://stackoverflow.com/questions/1103994/how-to-run-multiple-bat-files-within-a-bat-file (2认同)

nep*_*i12 0

start /wait /b "" "grunt --param=val1 --force"
start /wait /b "" "grunt --param=val2 --force"
Run Code Online (Sandbox Code Playgroud)

尝试一下...;)