title: Function to execute batch file C++
body: <p>I want to execute a batch file using system() and the path to the file will be passed to the function so it will look like this:</p>
  <pre><code>void executeBatch(char* BatchFile){
      system(BatchFile);
  }
  </code></pre>
  <p>Now the issue is that the path passed in will not have the escape quotes to ignore spaces for example the user would input:</p>
  <pre><code>&quot;C:\\Users\\500543\\Documents\\Batch File Project\\Testing.bat&quot;
  </code></pre>
  <p>How do I add escape quotes to the path passed in?</p>
  <p>So I essentually change:</p>
  <pre><code>&quot;C:\\Users\\500543\\Documents\\Batch File Project\\Testing.bat&quot;
  </code></pre>
  <p>to</p>
  <pre><code>&quot;\&quot;C:\\Users\\500543\\Documents\\Batch File Project\\Testing.bat\&quot;&quot;
  </code></pre>