title: How to execute a .bat file from node.js passing some parameters?
body: <p>I use node.js v4.4.4 and I need to run a <code>.bat</code> file from node.js.</p>
  
  <p>From the location of the js file for my node app the .bat is runnable using command line with the following path (Window platform): </p>
  
  <pre><code>'../src/util/buildscripts/build.bat --profile ../profiles/app.profile.js'
  </code></pre>
  
  <p>But when using node I cannot run it, no specific error are thrown.</p>
  
  <p>What am I doing wrong here?</p>
  
  <hr>
  
  <pre><code>    var ls = spawn('cmd.exe', ['../src/util/buildscripts', 'build.bat', '--profile ../profiles/app.profile.js']);
  
      ls.stdout.on('data', function (data) {
          console.log('stdout: ' + data);
      });
  
      ls.stderr.on('data', function (data) {
          console.log('stderr: ' + data);
      });
  
      ls.on('exit', function (code) {
          console.log('child process exited with code ' + code);
      });
  </code></pre>