title: Passing a string array from powershell to C#
body: <p>I would like to call a C# program from powershell and pass an array of parameters from powershell to the C# program.  The C# program takes a file path, date, and file extension and manipulates those files.</p>
  
  <p>In the powershell script I have, I store all the strings inside an array of strings and pass that string using the <code>-argumentlist</code> switch in <code>start-process</code>.</p>
  
  <p>Since these file paths are at my work I am going to make up some file paths for an example.
  The name of this script is <code>ProductionImportCaller</code></p>
  
  <pre><code>$ParametersToPass = "C:\my images,20130412,dat", "C:\my images\curiosity,20130412,bif"
  
  Start-Process -FilePath C:\Users\ABetterProductionImport.exe 
  -ArgumentList $ParametersToPass
  </code></pre>
  
  <p>The above does not have a new line in my script.  I just make it a newline on here so it is easier to read.</p>
  
  <p>When I call <code>.\ProductionImportCaller</code> the array that is passed is:  </p>
  
  <pre><code>c:\my
  images,20130412,dat  
  
  c:\my
  images\curiosity,20130412,bif
  </code></pre>
  
  <p>which I do not want.  </p>
  
  <p>So here is my question:
  How do I write my powershell script so these parameters will pass correctly?</p>
  
  <p>I have tried</p>
  
  <ol>
  <li>Replacing the double quotes with single quotes</li>
  <li>Surrounding each parameter with double quotes and surrounding the file path with singe quotes</li>
  </ol>
  
  <p>This works if I call:</p>
  
  <pre><code>start-process .\ABetterProductionImport.exe "C:\my images,20130412,dat"
  </code></pre>
  
  <p>EDIT: But if I call the same command from a script that I wrote this does not work.
  So again, how do I write a powershell script to make this run correctly?</p>