title: Delphi - CreateProcess - Execute multiple commands
body: <p>I want to achieve the following with a CreateProcess() - call:</p>
  
  <ol>
  <li>Change to an svn working-copy</li>
  <li>Execute svn commands</li>
  <li>Pipe the output to a file</li>
  </ol>
  
  <p>I try this with the following function</p>
  
  <pre><code>procedure TQPortMainForm.CmdMigrationClick(Sender: TObject);
  var
    StartInfo: TStartupInfo;
    ProcInfo: TProcessInformation;
    CreateOk: boolean;
    input: String;
  begin
    { fill with known state }
    FillChar(StartInfo, SizeOf(TStartupInfo), #0);
    FillChar(ProcInfo, SizeOf(TProcessInformation), #0);
    StartInfo.cb := SizeOf(TStartupInfo);
  
    //debug
    input := 'D: &amp;&amp; cd D:\Qport\trunk\Qport\ &amp;&amp; ' + SVN_PATH + ' log &gt; C:\users\PhilippKober\UNIQUE_NAME_BLUB.txt';
  
    CreateOk := CreateProcess(nil, PChar(input), nil, nil, false, CREATE_NEW_PROCESS_GROUP + NORMAL_PRIORITY_CLASS, nil,
      nil , StartInfo, ProcInfo);
    { check to see if successful }
    if CreateOk then
      // may or may not be needed. Usually wait for child processes
      WaitForSingleObject(ProcInfo.hProcess, INFINITE);
  end;
  </code></pre>
  
  <p>Simply nothing happens. Has anybody got an idea how to achieve this?</p>
  
  <p>Thanks,</p>
  
  <p>Philipp</p>
  
  <p>EDIT 1: I am using Delphi XE - Build 7601: Service Pack 1</p>
  
  <p>EDIT 2: Here is the solution:</p>
  
  <pre><code>var
    StartInfo: TStartupInfo;
    ProcInfo: TProcessInformation;
    CreateOk: boolean;
    input: String;
    path : String;
    cmd : String;
  begin
    { fill with known state }
    FillChar(StartInfo, SizeOf(TStartupInfo), #0);
    FillChar(ProcInfo, SizeOf(TProcessInformation), #0);
    StartInfo.cb := SizeOf(TStartupInfo);
  
    path := 'D:\Qport\trunk\Qport\';
    cmd := 'C:\Windows\System32\cmd.exe';
    //debug
    input := '/C' + SVN_PATH + ' help &gt; C:\users\PhilippKober\UNIQUE_NAME_BLUB.txt';
  
    CreateOk := CreateProcess(PChar(cmd), PChar(input), nil, nil, false, CREATE_NEW_PROCESS_GROUP + NORMAL_PRIORITY_CLASS, nil,
       Pchar(path), StartInfo, ProcInfo);
    { check to see if successful }
    if CreateOk then
      // may or may not be needed. Usually wait for child processes
      WaitForSingleObject(ProcInfo.hProcess, INFINITE);
  end;
  </code></pre>