title: Piping from a variable instead of file in Powershell
body: <p>Is ther any way in Powershell to pipe in from an virable instead of a file?</p>
  
  <p>There are commands that I need to pipe into another command, right now that is done by first creating a file with the additional commands, and then piping that file into the original command. Code looks somehting like this now:</p>
  
  <pre><code>$val = "*some command*" + "`r`n" + "*some command*" + "`r`n" + "*some command*"
  
  New-Item -name Commands.txt -type "file" -value $val
  
  $command = @'
  db2cmd.exe /C '*custom db2 command* &lt; \Commands.txt &gt; \Output.xml'
  '@
  
  Invoke-Expression -Command:$command
  </code></pre>
  
  <p>So instead of creating that file, can I somehow just pipe in <code>$val</code> insatead of Commands.txt?</p>