Skip to content

Select-Object: Allow combining -Skip and -SkipLast #11752

@mklement0

Description

@mklement0

See also: #13769

Summary of the new feature/enhancement

Select-Object's -Skip and -SkipLast parameters are currently in separate parameter sets, which syntactically prevents using them together.

However, there seems to be no good conceptual reason to prevent that, as it is conceivable that you may want to skip elements at both the beginning and end:

# WISHFUL THINKING
1..5 | Select-Object -Skip 1 -SkipLast 1
2
3
4
  • -Skip should be applied first.

  • -SkipLast must remain mutually exclusive with -First and -Last(which themselves can be combined with -Skip).

If the suggestion in #11750 is implemented, the same combination of parameters should also be allowed with Get-Content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions