从启动窗口10运行grunt watch

时间:2016-05-15 18:29:49

标签: gruntjs

每次我的电脑启动时,有没有办法打开命令提示符并从我的项目目录运行grunt watch?只是尝试自动化自动化,花了半个小时的谷歌搜索没有运气。

1 个答案:

答案 0 :(得分:0)

有一个模块将节点脚本安装为Windows服务,它叫做node-windows(npm,github,documentation)。我以前用过,就像魅力一样。

var Service = require('node-windows').Service;    
// Create a new service object
var svc = new Service({
name:'Hello World',
description: 'The nodejs.org example web server.',
script: 'C:\\path\\to\\helloworld.js'
});

// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});

svc.install();

安装它:

npm install -g qckwinsvc

安装您的服务:

> qckwinsvc
prompt: Service name: [name for your service]
prompt: Service description: [description for it]
prompt: Node script path: [path of your node script]
Service installed

卸载您的服务:

> qckwinsvc --uninstall
prompt: Service name: [name of your service]
prompt: Node script path: [path of your node script]
Service stopped
Service uninstalled