title: CreateProcess to execute Windows command
body: <p>I am trying to execute a dos command using CreateProcess function :</p>
  
  <pre><code> LPWSTR cmd=(LPWSTR)QString("C:\\windows\\system32\\cmd.exe  subst " + DLetter+"  \""+mountPath+"\"").utf16();
  
  
  
          STARTUPINFO si;
          PROCESS_INFORMATION pi;
          ZeroMemory( &amp;si, sizeof(si) );
          si.cb = sizeof(si);
          ZeroMemory( &amp;pi, sizeof(pi) );
  
          if ( CreateProcessW(0,     // Application name
                             cmd,                 // Application arguments
                             NULL,
                             NULL,
                             TRUE,
                             0,
                             NULL,
                             L"C:\\windows\\system32",          // Working directory
                             &amp;si,
                             &amp;pi) == TRUE)
          { ...
  </code></pre>
  
  <p>it give  as last error 3 = ERROR_PATH_NOT_FOUND, when I separate the application path <code>"C:\\windows\\system32\\cmd.exe"</code> from the command it shows the console without executing my subst command.</p>
  
  <p>Any help will be appreciated.</p>