title: How to pass string array to ps1 file?
body: <p>I'm using a Jenkins pipeline job. My requirement is to get all the commit messages for the job and pass it to the .ps1 file from Jenkins pipeline file and then from the .ps1 file to a cake file.</p>
  
  <p>I am using a string list to get all commit messages and later convert it to an array.</p>
  
  <p>Now, I need to pass this array value to the ps1 file from Jenkins pipeline file.
  I tried to pass like as a string in Jenkins pipeline file. It throws an exception. Could anyone please let me know is this possible to pass array value to the .ps1 file from Jenkins file?</p>
  
  <p><em>Jenkins file content:</em></p>
  
  <pre><code>bat 'powershell.exe -ExecutionPolicy ByPass -File build.ps1 -Script build.cake -Target build -arrayContent '+"${arrayContent}"
  </code></pre>
  
  <p><em>PS1 file content:</em></p>
  
  <pre><code>Invoke-Expression "&amp; `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" arrayContent=`"$arrayContent`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
  </code></pre>
  
  <p>I'm declaring the array as <code>[string[]]$arrayContent = @()</code> in the .ps1 file.</p>
  
  <p><em>Cake file content:</em></p>
  
  <pre><code>var arrayContent = Argument&lt;string[]&gt;("arrayContent");
  </code></pre>