I want to select the second/third/forth object of a Get-ChildItem
statement in my PowerShell script. This gives me the first:
$first = Get-ChildItem -Path $dir |
Sort-Object CreationTime -Descending |
Select-Object -First 1
This gives me the first three:
$latest = Get-ChildItem -Path $dir |
Sort-Object CreationTime -Descending |
Select-Object -First 3
I would like to get the second, or the third, or the fourth. (NOT the first two and so on).
Is there a way?