title: Proper path syntax for calling system() (as admin) to execute a .bat from a specific location?
body: <p>I have a simple program that reads in a basic config file which contains a user provided path. I'm trying to use that path to call system to execute a .bat that resides at the location provided. I'm able to pass the stored path directly into system and it attempts to run the .bat fine, but it needs to try and run it as an admin. I came across the following post: <a href="https://stackoverflow.com/questions/15523829/how-to-call-system-in-an-opened-administrator-program-and-gives-it-the-same-pr">How to call system() in an opened administrator program and gives it the same privileges?</a></p>
  
  <p>I'm building the string as indicated in the above post, but when I try and pass this new string into system, it tells me "The system cannot find the file specified". Here's the (most likely wrong) way I'm building the string that I pass into system.</p>
  
  <pre><code>std::string adminFilePath = "runas /user:&lt;admin-user&gt; \"";
  adminFilePath.append(configFileSettings.path.c_str()); //Append the path of the file that we got from the config file.
  adminFilePath.append("\"");
  system(adminFilePath.c_str());
  </code></pre>
  
  <p>My assumption is that I'm should be trying to build a basic string representing what I'd type right into a cmd window to execute the .bat, but obviously I'm wrong somewhere. </p>