使用.bat文件启动节点服务器

时间:2016-09-10 12:56:33

标签: node.js batch-file gruntjs

我想启动一个带有.bat文件的节点服务器,因为每次启动它时,都必须运行一个grunt任务。我在start.bat中尝试了以下几行:

grunt build
node index.js

当我执行它时,它只运行grunt build命令然后停止。如果我删除grunt build命令,它运行node index.js就好了。我做错了什么?

2 个答案:

答案 0 :(得分:4)

call一样尝试

call grunt build
node index.js

答案 1 :(得分:1)

如果你将命令与&&和它将确保第一个运行,然后运行第二个。 grunt build && node index.js 如果你希望它们仍然在单独的行上,胡萝卜将删除换行符。 grunt build &&^ node index.js

相关问题