Converts a path from a Windows PowerShell path to a Windows PowerShell provider path.
Syntax
Convert-Path [-LiteralPath] <string[]> [-UseTransaction] [<CommonParameters>] Convert-Path [-Path] <string[]> [-UseTransaction] [<CommonParameters>]
Description
The Convert-Path cmdlet converts a path from a Windows PowerShell path to a Windows PowerShell provider path.
Parameters
-LiteralPath <string[]>
Specifies the path to be converted. The value of the LiteralPath parameter 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.
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Path <string[]>
Specifies the Windows PowerShell path to be converted.
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
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 about_Transactions.
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
Inputs and Outputs
The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.
Inputs |
System.String You can pipe a path (but not a literal path) to Convert-Path. |
Outputs |
System.String Convert-Path returns a string that contains the converted path. |
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 Convert-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.
Example 1
C:\PS>convert-path ~ This command expands the current working directory.
Example 2
C:\PS>convert-path HKLM:\software\microsoft This command converts the Windows PowerShell provider path to a standard registry path.
See Also