Skip to content

Resolve-Path -RelativeBasePath is ignored unless -Relative is also specified, should imply the latter #20920

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

The -RelativeBasePath string parameter qualifies the -Relative switch.

Currently, -RelativeBasePath is ignored if -Relative isn't also specified.

The better solution is for -RelativeBasePath to imply -Relative, analogous to how, with Get-ChildItem, -Depth implies -Recurse.

Update: Turns out that -RelativeBasePath without -Relative does have a use case, albeit only with relative input paths; see comments below.

Resolve-Path $Home -RelativeBasePath /  # -Relative not specified; should be implied

Expected behavior

E.g., on Windows:

.\Users\jdoe

Actual behavior

E.g., on Windows:

Path
----
C:\Users\jdoe

That is, -RelativeBasePath was quietly ignored.

Error details

No response

Environment data

PowerShell 7.4.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions