Resolve-Path
Resolves the wildcard characters in a path, and displays the path contents.
構文
Path (既定)
Resolve-Path
[-Path] <String[]>
[-Relative]
[-Credential <PSCredential>]
[-UseTransaction]
[<CommonParameters>]
LiteralPath
Resolve-Path
-LiteralPath <String[]>
[-Relative]
[-Credential <PSCredential>]
[-UseTransaction]
[<CommonParameters>]
説明
The Resolve-Path
cmdlet displays the items and containers that match the wildcard pattern at the
location specified. The match can include files, folders, registry keys, or any other object
accessible from a PSDrive provider.
例
Example 1: Resolve the home folder path
The tilde character (~) is shorthand notation for the current user's home folder. This example
shows Resolve-Path
returning the fully qualified path value.
PS C:\> Resolve-Path ~
Path
----
C:\Users\User01
Example 2: 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.
Example 3: 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
.
Example 4: Resolve a UNC path
PS C:\> Resolve-Path -Path "\\Server01\public"
This command resolves a Universal Naming Convention (UNC) path and returns the shares in the path.
Example 5: 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.
Example 6: Resolve a path containing brackets
This example uses the LiteralPath parameter to resolve the path of the Test[xml] subfolder. Using LiteralPath causes the brackets to be treated as normal characters rather than a regular expression.
PS C:\> Resolve-Path -LiteralPath 'test[xml]'
パラメーター
-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 pass a PSCredential object. You can
create a PSCredential object using the Get-Credential
cmdlet. If you type a user name, this
cmdlet prompts you for a password.
This parameter is not supported by any providers installed with PowerShell.
パラメーターのプロパティ
型: | PSCredential |
規定値: | None |
ワイルドカードのサポート: | False |
DontShow: | False |
パラメーター セット
(All)
配置: | Named |
必須: | False |
パイプラインからの値: | False |
プロパティ名別のパイプラインからの値: | True |
残りの引数からの値: | False |
-LiteralPath
Specifies the path to be resolved. The value of the LiteralPath parameter is used exactly as typed. No characters are interpreted as wildcard characters. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.
パラメーターのプロパティ
型: | String[] |
規定値: | None |
ワイルドカードのサポート: | False |
DontShow: | False |
Aliases: | PSPath |
パラメーター セット
LiteralPath
配置: | Named |
必須: | True |
パイプラインからの値: | False |
プロパティ名別のパイプラインからの値: | True |
残りの引数からの値: | False |
-Path
Specifies the PowerShell path to resolve.
This parameter is required.
You can also pipe a path string to Resolve-Path
.
パラメーターのプロパティ
型: | String[] |
規定値: | None |
ワイルドカードのサポート: | False |
DontShow: | False |
パラメーター セット
Path
配置: | 1 |
必須: | True |
パイプラインからの値: | True |
プロパティ名別のパイプラインからの値: | True |
残りの引数からの値: | False |
-Relative
Indicates that this cmdlet returns a relative path.
パラメーターのプロパティ
型: | SwitchParameter |
規定値: | None |
ワイルドカードのサポート: | False |
DontShow: | False |
パラメーター セット
(All)
配置: | Named |
必須: | False |
パイプラインからの値: | False |
プロパティ名別のパイプラインからの値: | False |
残りの引数からの値: | 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.
パラメーターのプロパティ
型: | SwitchParameter |
規定値: | False |
ワイルドカードのサポート: | False |
DontShow: | False |
Aliases: | usetx |
パラメーター セット
(All)
配置: | Named |
必須: | False |
パイプラインからの値: | False |
プロパティ名別のパイプラインからの値: | False |
残りの引数からの値: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
入力
String
You can pipe a string that contains a path to this cmdlet.
出力
System.Management.Automation.PathInfo, System.String
Returns a PathInfo object. Returns a string value for the resolved path if you specify the Relative parameter.
メモ
- The
*-Path
cmdlets work with the FileSystem, Registry, and Certificate providers. Resolve-Path
is designed to work with any provider. To list the providers available in your session, typeGet-PSProvider
. For more information, see about_providers.