I want to select the second/third/forth object of a Get-ChildItem statement in my PowerShell script. This gives me the first:
Get-ChildItem
$first = Get-Child
The second approach suggested by @AnsgarWiechers can easily be turned into a simple reusable funtion, like so:
function Select-Nth { param([int]$N) $Input | Select-Object -First $N | Select-Object -Last 1 }
And then
PS C:\> 1,2,3,4,5 |Select-Nth 3 3