Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot bind argument to parameter 'Path'

Status
Not open for further replies.

Marclem

Technical User
Aug 5, 2003
87
US
Hi Support Team,

I am running the below command in PowerShell and getting below error message but still the data gets copied over:

PS C:\AWARDS> Get-Content .\AACE001N.txt | Foreach-Object { copy-item -Path $_ -Destination C:\AWARDS\AACE001N\}

[highlight #CC0000]Copy-Item : Cannot bind argument to parameter 'Path' because it is an empty string.
At line:1 char:63
+ ... -Content .\AACE001N.txt | Foreach-Object { copy-item -Path $_ -Destin ...
+ ~~
+ CategoryInfo : InvalidData: :)) [Copy-Item], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Copy
ItemCommand
[/highlight]

Thank you for your support
 
On first glance, it would suggest you have a blank line in AACE001N.txt

So try skipping blank lines, e.g

[tt]Get-Content .\AACE001N.txt | Where-Object { $_.Trim() -ne '' } | Foreach-Object { copy-item -Path $_ -Destination C:\AWARDS\AACE001N\}[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top