title: Robocopy, Multi-Line Execute Process SSIS Task, or Output Batch File Results to SSIS
body: <p>I need to robocopy files from one location to another in a SSIS package.  Since the folder is on another domain, I need to impersonate another account before I run the robocopy.exe command.  I found I can execute a "net use" command to impersonate the necessary user account and then execute the robocopy command immediately afterwards.  I don't see any way to do this in an Execute Process command to do this directly, so I use an Execute Process task to run a batch file that has these two commands as separate lines.  The downside of this approach is that I cannot read the results of the Execute Process command.  So this leads me to three questions:</p>
  
  <ol>
  <li>Is there a way to execute a multi-line command in a single Execute Process task?</li>
  <li>Is there a way to execute robocopy.exe while impersonating another account in one line?</li>
  <li>Is there a way to write the results of a batch file back to either a variable in SSIS or to the SSIS database log?</li>
  </ol>
  
  <p>If there is a positive answer for any of the above three questions, then I may be able to work out a way to add job success or failure rules based on the results of the robocopy command.</p>