Hi guys,
I am trying to pull data from one file to another
This works fine:
gc "c:\file1.txt" | ? {$_ -match "lun:/vol/"} | Add-Content "c:\file2.txt"
but this fails:
$source = Read-Host "enter full path to source file"
$dest = Read-Host "enter full path to destination file"
gc $source | ? {$_ -match "lun:/vol/"} | Add-Content $dest
Get-Process : A positional parameter cannot be found that accepts argument 'gc'.
At C:\perf_file.ps1:11 char:3
+ PS <<<< C:\> gc $source | ? {$_ -match "lun:/vol/"} | Add-Content $dest
+ CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand
what am I doing wrong?
Thank you
Joel