Table of contents
ISE
TOC
Collapse the table of content
Expand the table of content

Resolve-Path

JuanPablo Jofre|Last Updated: 11/17/2016
|
2 Contributors

SYNOPSIS

Resolves the wildcard characters in a path, and displays the path contents.

SYNTAX

Path (Default)

Resolve-Path [-Path] <String[]> [-Relative] [-Credential <PSCredential>] [-UseTransaction] [<CommonParameters>]

LiteralPath

Resolve-Path -LiteralPath <String[]> [-Relative] [-Credential <PSCredential>] [-UseTransaction]
 [<CommonParameters>]

DESCRIPTION

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.

EXAMPLES

-------------------------- EXAMPLE 1 --------------------------

PS C:\>resolve-path ~
C:\Users\User01

This command resolves the path represented by the tilde character (~), which represents the home path of a file system drive, such as C:.

-------------------------- EXAMPLE 2 --------------------------

PS C:\>resolve-path windows
C:\Windows

When run from the root of the C: drive, this command returns the path to the Windows directory in the C: drive.

-------------------------- EXAMPLE 3 --------------------------

PS C:\>"C:\windows\*" | resolve-path

This command returns all of the directories in the C:\Windows directory. The command uses a pipeline operator (|) to send a path string to Resolve-Path.

-------------------------- EXAMPLE 4 --------------------------

PS C:\>resolve-path \\Server01\public

This command resolves a Universal Naming Convention (UNC) path and returns the shares in the path.

-------------------------- EXAMPLE 5 --------------------------

PS C:\>resolve-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.

-------------------------- EXAMPLE 6 --------------------------

PS C:\>resolve-path -literalPath test[xml]

This command resolves the path to the Test[xml] subdirectory of the current directory. It uses the LiteralPath parameter to indicate that the brackets are not regular expression characters.

PARAMETERS

-Credential

Specifies a user account that has permission to perform this action. The default is the current user.

Type a user name, such as "User01" or "Domain01\User01". Or, enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

This parameter is not supported by any providers installed with Windows PowerShell.

Type: PSCredential
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: Current user
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-LiteralPath

Specifies the path to be resolved. The value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

Type: String[]
Parameter Sets: LiteralPath
Aliases: PSPath

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Path

Specifies the Windows PowerShell path to resolve. This parameter is required. You can also pipe a path string to Resolve-Path.

Type: String[]
Parameter Sets: Path
Aliases: 

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Relative

Returns a relative path.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-UseTransaction

Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see

Type: SwitchParameter
Parameter Sets: (All)
Aliases: usetx

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

System.String

You can pipe a string that contains a path to Resolve-Path.

OUTPUTS

System.Management.Automation.PathInfo or System.String

If you use the Relative parameter, Resolve-Path returns a string that contains the resolved path. Otherwise, it returns a PathInfo object.

NOTES

  • The cmdlets that contain the Path noun (the Path cmdlets) manipulate 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 like you would use Dirname, Normpath, Realpath, Join, or other path manipulators.

    You can use the Path cmdlets with several providers, including the FileSystem, Registry, and Certificate providers.

    The Resolve-Path cmdlet 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.

*

Convert-Path

Join-Path

Split-Path

Test-Path

about_Providers

© 2016 Microsoft