Reputation: 675
I know this has been answered a couple of times before, but that didn't work for me.
My Code is:
var cp = require("child_process");
cp.exec("C:\Program Files\VideoLAN\VLC\vlc.exe");
When I start the JS file with NodeJS it doesn't do anything. Can someone help me with this?
Upvotes: 1
Views: 1922
Reputation: 10997
This question is too old,may be useful for someone
it opens windows calculator(calc.exe)
var childProcess = require('child_process');
childProcess.exec('start calc.exe', function (err, stdout, stderr) {
if (err) {
console.error(err);
return;
}
console.log(stdout);
process.exit(0);// exit process once it is opened
})
Upvotes: 2
Reputation: 106746
You have to escape your backslashes and quote the path because it contains a space:
var cp = require("child_process");
cp.exec('"C:\\Program Files\\VideoLAN\\VLC\\vlc.exe"');
Upvotes: 2