使用NodeJS在特定目录中运行命令

时间:2014-09-21 20:51:36

标签: javascript node.js

我正在使用Brackets核心构建HTML,CSS和打字稿的桌面应用程序。 我的问题是:是否可以使用Node.js运行命令?我想将CD转到目录中,然后运行grunt serve。

我搜索了Google和Node网站,但找不到任何内容。

谢谢你

斯文

1 个答案:

答案 0 :(得分:0)

http://nodejs.org/api/child_process.html

child_process.exec('shell command', {cwd: 'current work dir'}, function(err, stdout, stderr) {});