title: Run batch file from Electron main thread
body: <p>I'm attempting to run a simple batch file from my electron application. Here is my code:</p>
  
  <pre><code>globalShortcut.register('Control+B', () =&gt; {
      log.info('Batch File Triggered: ' + app.getAppPath() + '\\local\\print.bat')
      require('child_process').exec(app.getAppPath() + '\\local\\print.bat', function (err, stdout, stderr) {
          if (err) {
              // Ooops.
              // console.log(stderr);
              return console.log(err);
          }
  
          // Done.
          console.log(stdout);
      });
  })
  </code></pre>
  
  <p>The batch file should be triggered when Control+B is pressed by the user, but it does not work. The log entry is made, and I've verified the path is correct, but the file is never actually launched.</p>
  
  <p>I found these questions, which ask the same question, but these are 4 years old at this point and none of the answers have worked for me, there is no display, no error, nothing.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/22678933/run-a-windows-batch-file-from-node-js">run a windows batch file from node.js</a></li>
  <li><a href="http://stackoverflow.com/questions/21557461/execute-a-batch-file-from-nodejs">http://stackoverflow.com/questions/21557461/execute-a-batch-file-from-nodejs</a></li>
  </ul>
  
  <p>I've also tried the child_process.spawn but that also did nothing noticeable.</p>
  
  <pre><code>var ls = spawn('cmd.exe', ['/c', app.getAppPath() + '\\local\\print.bat']);
  </code></pre>
  
  <p>How can I launch my batch file from my electron application?</p>