title: Need help with simple powershell command copy using foreach
body: <p>I'm new to powershell and this question will prove that point.  I'm trying a simple task from the command line where I have a txt file containing filenames separated by semicolons like...</p>
  
  <pre><code>fnameA.ext;fnameB.ext;fnameC.ext;....
  </code></pre>
  
  <p>I'm trying to run a command which will parse this file, split the contents by semicolon, and then run a copy command for each file to a desired directory.</p>
  
  <p>Here is the command I'm running:</p>
  
  <p><code>gc myfile.txt |% {$_.split(";") | copy $_ "C:\my\desired\directory"}</code></p>
  
  <p>But I'm getting an error like this for each item in the list...</p>
  
  <pre><code>Copy-Item : The input object cannot be bound to any parameters for the command either because the command does not take
   pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
  At line:1 char:36
  + gc bla.txt |% {$_.split(";") | copy &lt;&lt;&lt;&lt;  $_ "C:\my\desired\directory"}
      + CategoryInfo          : InvalidArgument: (fileA.txt:String) [Copy-Item], ParameterBindingException
      + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.CopyItemCommand
  </code></pre>