title: How can I find why system can not run my application?
body: <p>I have a c++ program that run a command and pass some arguments to it. The code is as follow:</p>
  <pre><code> int RunApplication(fs::path applicationPathName,std::string arguments)
   {
      std::string applicationShortPath=GetShortFileName(applicationPathName);
      std::string cmd=&quot;\&quot;&quot;+applicationShortPath +&quot;\&quot;  &quot;+ arguments+&quot; &gt;&gt;log.txt 2&gt;&amp;1 \&quot;&quot;;
      std::cout&lt;&lt;cmd&lt;&lt;std::endl;
      int result=std::system(cmd.c_str());
      return result;
   }
  </code></pre>
  <p>When I run system command, the cmd window appears shortly and then closes, but the result is 1 and the cmd was not run (the command should generate output which is not generated).</p>
  <p>To check that the cmd is correct, I stopped the application just before system line and copy/ paste cmd content to a cmd window and it worked.</p>
  <p>I am wondering how can I find why application is not run in system()?</p>
  <p>the cmd has this value just before running it:</p>
  <pre><code>&quot;D:/DEVELO~3/x64/Debug/enfuse.exe&quot;  -w --hard-mask --exposure-weight=1 --saturation-weight=0.328 --contrast-weight=0.164 -o &quot;C:/Users/m/AppData/Local/Temp/1.tif&quot;  &quot;C:/Users/m/AppData/Local/Temp/1.jpg&quot; &quot;C:/Users/m/AppData/Local/Temp/2.jpg&quot;  &gt;&gt;log.txt 2&gt;&amp;1 &quot;
  </code></pre>
  <p>How can I find why it is not working?</p>
  <p>Is there any way that I set the system so it doesn't close cmd window so I can inspect it?</p>
  <p>is there any better way to run a command on OS?</p>
  <p>Does Boost has any solution for this?</p>
  <h3>Edit</h3>
  <p>After running it with cmd /k, I get this error message:</p>
  <pre><code>The input line is too long.
  </code></pre>
  <p>How can I fix it other than reducing cmd line?</p>