title: Node.js run command line (child_process?)
body: <p>I have a Node.js program where I need to, on a button click, run 2 commands in the Windows command line. For example, the process I'm trying to automate by the button click would be doable manually by going to cmd and entering the following commands:</p>
  <pre><code>pushd \\myserver.com\folder1\folder2         //Connect to remote server folder structure
  mkdir NewFolder                              //Create new folder in the remote folder
  </code></pre>
  <p>I've found many resources pointing that I should use 'child_process', but I'm absolutely lost when it comes to shell scripting and am having a really hard time figuring out how to do this. Here's the code I have so far:</p>
  <pre><code>var cp = require('child_process');
  cp.exec('pushd \\\\myserver.com\\folder1\\folder2\\', { shell: '/bin/bash' }, function(err, stdout, stderr){
      if(err){
          console.log(err);        
      }
  });
  </code></pre>
  <p>But this above code just returns this error (which oddly removes the '\'s from the given dir):</p>
  <pre><code>{ Error: Command failed: pushd \\myserver.com\folder1\folder2\
  /bin/bash: line 1: pushd: \myserver.comfolder1folder2: No such file or directory
      at ChildProcess.exithandler (child_process.js:281:12)
  
    killed: false,
    code: 1,
    signal: null,
    cmd: 'pushd \\\\myserver.com\\folder1\\folder2\\' }
  /bin/bash: line 1: pushd: \myserver.comfolder1folder2: No such file or directory
  </code></pre>
  <p>I'm really lost here and would appreciate any help. Any alternative you have to child_process may also be very helpful. Thank you!</p>