Get the absolute path of a relative path with Resolve-Path

Expand ~, .., and wildcards into full provider paths — and get back a relative path with -Relative.

WindowsFilesscriptingpowershellLow risk
Run Resolve-Path <path> to turn a relative or wildcard path into fully qualified absolute paths; add -Relative for the opposite.

01Command

Command
$ Resolve-Path '..\logs\*.log'

02What it does

Resolve-Path resolves the current location, so '..\logs' becomes e.g. 'C:\Work\logs' regardless of how the script was invoked. Each matching item is returned as a PathInfo object whose .Path property is the plain string. The often-missed -Relative flag prints matches relative to the current directory, and -LiteralPath handles paths containing [brackets] that would otherwise be treated as wildcards.

03Risk

RiskLow risk
RequirementsPowerShell
!Warning: Resolve-Path fails if the path doesn't exist — to expand a not-yet-created path use [System.IO.Path]::GetFullPath() or (Resolve-Path <parent>).Path + name.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Resolve-Path | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents that Resolve-Path interprets wildcards and relative paths and returns the fully qualified provider path for each match.
  • Resolve-Path - PowerShell
    SS64 · technical · 2026-09-17
    Evidence: SS64 shows Resolve-Path resolving relative paths, ~, and wildcards to absolute paths, and -Relative for the reverse operation.

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions