title: diskpart does not process script correctly when executed from CreateProcess()
body: <p><strong>diskpart "myScript.txt":</strong></p>
  
  <pre><code>select disk 1
  convert dynamic noerr
  select disk 2
  convert dynamic noerr
  create volume stripe disk=1,2 noerr
  assign letter=X noerr
  </code></pre>
  
  <p>.<br>
  .  </p>
  
  <p>When running from the command prompt:     <code>diskpart /s myScript.txt</code>  <strong>it works as expected</strong>.</p>
  
  <p><strong>However</strong>, when run using win api's <code>CreateProcess()</code> both the convert commands <em>do</em> work but when it gets to<br>
   <code>create volume</code>, it displays:  </p>
  
  <pre><code>"The arguments you specified for this command are not valid"
  </code></pre>
  
  <p>.
  .  </p>
  
  <p>Now, to make things more interesting:<br>
  <strong>If the script is executed again</strong> from CreateProcess() a 2nd time (given the disks are now converted and it gives a <em>correct error</em> for the convert comamnds), 
  when it gets to the <code>create volume</code>, <strong>it does work.</strong>  </p>
  
  <p>This makes me think it has something do with the disks and or executable?</p>
  
  <p>Any point in the right direction is appreciated as this is very confusing. Thanks.  </p>
  
  <pre><code>STARTUPINFO si;
  PROCESS_INFORMATION pi;
  ZeroMemory(&amp;si, sizeof(si));
  ZeroMemory(&amp;pi, sizeof(pi));
  si.cb = sizeof(si);
  strncpy( command, "diskpart.exe /s myScript.txt", (sizeof(command) - 1) );  
  
               CreateProcess( "c:\\WINDOWS\\system32\\diskpart.exe",
                               command,
                               NULL,
                               NULL,
                               TRUE,
                               0,
                               NULL,
                               NULL,
                               &amp;si,
                               &amp;pi ) );
  </code></pre>
  
  <p>end original question________________________________________________________</p>
  
  <p><strong>EDIT:<br>
  Updates and more info:</strong>    </p>
  
  <ul>
  <li><p>Added about 15 - 20 seconds worth of delay before create volume command, still got the same error message.</p></li>
  <li><p>Also, split the work into two scripts, with two calls to
  CreateProcess(). On the second script, just calling "create volume"
  and assign, it hung for a while and then came back with a "this
  command cannot be completed at this time"..or something to the
  effect.</p></li>
  <li><p>Another thing to note: On the first script, putting them into
  dynamic, it was running about twice as slow compared to running with
  command prompt.</p></li>
  </ul>
  
  <p>Maybe should just run the whole thing twice (with errors on the second run) as that did work</p>
  
  <p><strong>EDIT2</strong><br>
  The 2 scripts is now working, or worked when I tried it again. Not sure why it didn't work the first time.</p>