Reputation: 71
Can someone help me in finding a solution for executing a batch file using java-script, i am currently working with nw.js and i tried couple of things which worked for .exe but not for .bat
var execFile = require
('child_process').execFile, child;
child = execFile('C:\\WorkLog\\Software\\abc.exe', //works
//child = execFile('C:\\PDFRotation\\Run.bat', //not working
Upvotes: 0
Views: 1127
Reputation: 3932
You don't actually execute a batch file. You execute cmd.exe and give it the batch file as a parameter.
Upvotes: 1
Reputation: 6047
A batch program is not really an executable, so you might have to use cmd.exe
to invoke the batch file try something like:
var spawn = require('child-process').spawn;
spawn('cmd.exe', ['yourfile.bat']);
Upvotes: 2