title: Create Out-File-names using array elements
body: <p>I need to create .txt/.sap files/shortcuts with changing content. I use a do until loop and the file names should be created with strings from an array. I cannot use the square brackets to access the array because Powershell interprets them as a wild card characters.</p>
  
  <p>The following code shows the principle:</p>
  
  <pre><code>$strSAPSystems = @("Production", "Finance", "Example")
  
  $i = 0
  do{
  "text1" | Out-File .\SAP_$strSAPSystems[$i].sap
  "text2" | Out-File .\SAP_$$strSAPSystems[$i].sap -Append
  $i++
  }
  until($i -eq $strSAPSystems.length)
  </code></pre>
  
  <p>results in an error: "out-file : cannot perform operation because the wildcard path ... did not resolve to a file"</p>
  
  <p>I tried to add the -literalPath parameter but it didn't work. I am new to Powershell, is there a better way to have the files named after the SAP systems?</p>
  
  <p>Thank you</p>