Resolving Paths

by Jun 21, 2012

Paths can be relative, such as ". \file.txt". To resolve such a path and display its full path, you could use Resolve-Path:

PS> Resolve-Path .\file.txt

Unfortunately, though, Resolve-Path expects the file to really exist, so you cannot use it on hypothetical paths. To resolve all paths, whether they exist or not, use this line instead:

PS> $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath('.\file.txt')

Twitter This Tip! ReTweet this Tip!