I try
1..4 | gc
will error
gc : The input object cannot be bound to any parameters for the command either because the command does not take pip
eline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:8
+ 1..4 | gc
+ ~~
+ CategoryInfo : InvalidArgument: (1:Int32) [Get-Content], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.GetContentCommand
gc : The input object cannot be bound to any parameters for the command either because the command does not take pip
eline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:8
+ 1..4 | gc
+ ~~
+ CategoryInfo : InvalidArgument: (2:Int32) [Get-Content], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.GetContentCommand
gc : The input object cannot be bound to any parameters for the command either because the command does not take pip
eline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:8
+ 1..4 | gc
+ ~~
+ CategoryInfo : InvalidArgument: (3:Int32) [Get-Content], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.GetContentCommand
gc : The input object cannot be bound to any parameters for the command either because the command does not take pip
eline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:8
+ 1..4 | gc
+ ~~
+ CategoryInfo : InvalidArgument: (4:Int32) [Get-Content], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.GetContentCommand
but Iike ls -File -Filter *.txt | gc
is fine
if I try 1..4 | %{ gc $_}
is fine
Why happen this ?