I would like to
C:\>ACommandThatGetsData > save.txt
But instead of parsing and saving the data in the console, I would like to do the above command with Node.JS
How to execute a shell command with Node.JS?
I would like to
C:\>ACommandThatGetsData > save.txt
But instead of parsing and saving the data in the console, I would like to do the above command with Node.JS
How to execute a shell command with Node.JS?
Useprocess.execPath()
:Update
I should have read the documentations better.
There is a Child Process Module which allows to execute a child process. You will need either
child_process.exec
,child_process.execFile
orchild_process.spawn
. All of these are similar in use, but each has its own advantages. Which of them to use depends on your needs.You could also try the node-cmd package: