Resolves the wildcard characters in a path, and displays the path contents.
Resolve-Path [-Path*] <String> [-Credential [<PSCredential>]] [-Relative] [-UseTransaction [<SwitchParameter>]][<CommonParameters>]
Resolve-Path [-Credential [<PSCredential>]] [-Relative] -LiteralPath* <String> [-UseTransaction[<SwitchParameter>]] [<CommonParameters>]
The Resolve-Path cmdlet interprets the wildcard characters in a path and displays the items and containers at the location specified by the path, such as the files and folders or registry keys and subkeys.
You can pipe a string that contains a path to this cmdlet.
This cmdlet returns a string that contains the resolved path, if you specify the Relative parameter. Otherwise, it returns a PathInfo object.
- Resolve the current path:
PS C:> Resolve-Path ~ Path ---- C:UsersUser01
This command resolves the path represented by the tilde character (~), which represents the home path of a file system drive, such as C:.
- Resolve the path of the Windows folder:
PS C:> Resolve-Path -Path "windows" Path ---- C:Windows When run from the root of the C: drive, this command returns the path of the Windows folder in the C: drive.
- Get all paths in the Windows folder:
PS C:> "C:windows*" | Resolve-Path
This command returns all of the folders in the C:Windows folder. The command uses a pipeline operator (|) to send a path string to Resolve-Path.
- Resolve a UNC path:
PS C:> Resolve-Path -Path "\Server01public"
This command resolves a Universal Naming Convention (UNC) path and returns the shares in the path.
- Get relative paths:
PS C:> Resolve-Path -Path "c:prog*" -Relative ..Program Files ..Program Files (x86) ..programs.txt
This command returns relative paths for the directories at the root of the C: drive.
- Resolve a path that contains brackets:
PS C:> Resolve-Path -LiteralPath 'test[xml]'
This command resolves the path of the Test[xml] subfolder of the current folder. It uses the LiteralPath parameter to indicate that the brackets are not regular expression characters.
The cmdlets that contain the Path noun (the Path cmdlets) work with path names and return the names in a concise format that all Windows PowerShell providers can interpret. They are designed for use in programs and scripts where you want to display all or part of a path name in a particular format. Use them as you would use Dirname, Normpath, Realpath, Join, or other path manipulators. You can use the Path cmdlets with several providers. These include the FileSystem, Registry, and Certificate providers. Resolve-Path is designed to work with the data exposed by any provider. To list the providers available in your session, type Get-PSProvider. For more information, see about_Providers.