I am using
var version = shell.exec('D:\\prompt.bat', {silent:false}).output;
Shelljs module of npm to run .bat file
this .bat file opens the iexplore.exe and internet explorer opens up
BUT The problem is it runs on single thread so untill and unless IE is not bieng closed my server is waitng and not processing any further request,
so anyone can please suggest me how to run DOS command on separate thread so that it does not affect my server.
thanks in advance. :)
You can indeed use something different like child_process or exec to create async process, but node.js is still not going to exit until the child process is finished or timed out. Though it will continue execution.
Example (source):
var exec = require('exec');
exec(['D:\\prompt.bat'], function(err, out, code) {
if (err instanceof Error)
throw err;
process.stderr.write(err);
process.stdout.write(out);
process.exit(code);
});
Alternative and easier method: you can try running async CMD code, that is solving issue not in Node.js but in script.
For instance change the line to:
var version = shell.exec('start D:\\prompt.bat', {silent:false}).output;
Or you could add command start
inside of a prompt.bat
.
i found answer for my second question in comment by myself:
in place of c:\... something use c:/ that is it. :)