I’m picking up where I left off in my last blog article on the new features in the PowerShell version 5 preview. Today I be covering a new parameter, SkipLast that has been added to the Select-Object cmdlet.
I have a text file where I saved a list of the available packages in the default OneGet Chocolatey repository. There are a total of 1893 items in this file:
(Get-Content -Path C:\demo\packages.txt).count
I’ll use the new SkipLast parameter to skip the last 1885 items:
Get-Content -Path C:\demo\packages.txt | Select-Object -SkipLast 1885
This blog article has been written based on the preview version of PowerShell version 5 from the May 2014 release of the Windows Management Framework 5.0 preview so what you’ve seen here is subject to change in the final release version.
This blog article is one of many that I’ve written and will be writing about the new features in PowerShell version 5. You can find my other blog articles on PowerShell version 5 here.