Can someone please explain why the following doesn't work?
Function Range
{
Write-Host
$range1 = Read-Host -Prompt "Begin range at ref number?"
Write-Host
$range2 = Read-Host -Prompt "End range at ref number?"
$big | ? { $_.REF -ge $range1 -and $_.REF -le $range2 } | Export-Csv -NoTypeInformation .\stock-labels.csv
Write-Host
Write-Host Finished
Write-Host
Write-Host
Write-Host "Press any key to close ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
I want to pull referance numbers in a range from a csv file and write a smaller csv file.
The code above seems to ignore the -le bit and give me everything greater than or equal to $range1.
Any help much appreciated.
Thanks.