title: C++ Executing CMD Commands
body: <p>I'm having a serious problem here. I need to execute a CMD command line via C++ without the console window displaying. Therefore I cannot use <code>system(cmd)</code>, since the window will display.</p>
  
  <p>I have tried <code>winExec(cmd, SW_HIDE)</code>, but this does not work either. <code>CreateProcess</code> is another one I tried. However, this is for running programs or batch files.</p>
  
  <p>I have ended up trying <code>ShellExecute</code>:</p>
  
  <pre><code>ShellExecute( NULL, "open",
      "cmd.exe",
      "ipconfig &gt; myfile.txt",
      "c:\projects\b",
      SW_SHOWNORMAL
  );
  </code></pre>
  
  <p>Can anyone see anything wrong with the above code? I have used <code>SW_SHOWNORMAL</code> until I know this works.</p>
  
  <p>I really need some help with this. Nothing has come to light, and I have been trying for quite a while. Any advice anyone could give would be great :)</p>