|
Newbie: filter rows with variable Hi,
I want to call a .ps1 script with a parameter which is used as a
parameter to limit the rows read from a file.
I have tried the following:
ps> list.ps1 <searchcriteria>
list.ps1:
gc c:\temp\test.txt | where {$_ -like "*$args*"} | sort
but I cant get it to work. It does not fail but no rows are returned.
What is wrong here?
Also, when the parameter includes @ (e.g. @work), I get I an error:
Unrecognized token in source text.
At line:1 char:12
+ .\list.ps1 @ <<<< work
How can I avoid this without escaping the @ when entering the
parameter?
thanks, |