Resolve-Path 帮助信息

本文介绍 PowerShell 中 Resolve-Path 命令的使用方法,包括解析路径中的通配符,并显示匹配的内容,如文件、文件夹等。文章还提供了具体实例演示如何使用此命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如下说明是翻译: help Resolve-Path 产生的帮助信息.
译者: Edengundam(马涛)
 
Resolve-Path
 
大纲
解析路径中的通配符, 并显示路径匹配内容.
 
语法
Resolve-Path [-path] <string[]> [-credential <PSCredential>] [<CommonParameters>]
 
Resolve-Path [-literalPath] <string[]> [-credential <PSCredential>] [<CommonParameters>]
 
详细描述
解析路径中的通配符, 并显示路径指定位置的项目和内容, 例如: 像文件和文件夹或注册表键和子键. 名称将会按照他们在驱动器中的内容显示, 并且会区分大小写.
 
参数
 
-path <string[]>
指定需要解析的Windows PowerShell路径.
 
强制参数?
true
参数位置?
1
默认值
 
允许从管道绑定输入?
true (根据值, 根据属性名)
允许通配符扩展?
true
 
-credential <PSCredential>
使用其他凭证进行资源访问认证. <Credential>代表着用户名(例如: "User01""Domain01/User01") 或者PSCredential对象(例如: 通过Get-Credential cmdlet取得的对象). 如果此处使用用户名, 命令执行时会提示输入该用户密码. 尽管此参数出现, 但是并非所有Windows PowerShell核心cmdletsproviders支持此功能.
 
强制参数?
false
参数位置?
named
默认值
 
允许从管道绑定输入?
true (根据属性名)
允许通配符扩展?
false
 
-literalPath <string[]>
指定解析的路径. 参数-LiteralPath的值将会按照输入的形式被使用. 不会对任何通配符进行解释. 如果路径中包含了转义字符, 需要将路径用单引号保护. 单引号指示Windows PowerShell不对字符串中的转义字符进行处理.
 
强制参数?
true
参数位置?
1
默认值
 
允许从管道绑定输入?
true (根据属性名)
允许通配符扩展?
false
 
<公共参数>
此命令支持公共参数: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. 更多信息, 输入, "get-help about_commonparameters".
 
输入类型
字符串
 
返回类型
字符串
 
注意
 
更多信息, 输入"Get-Help Resolve-Path -detailed".需要技术信息, 输入"Get-Help Resolve-Path -full".
 
路径类的cmdlets (*-path)操作路径名称, 并返回Windows PowerShell供应程序能够解释的简单名称格式. 设计这些命令为了在程序或脚本中, 允许显示全部或部分路径名称为特定的格式. 使用它们就好像是用Dirname, Normpath, Realpath, Join, 或者其他路径操作命令.
 
你可以在不同供应程序上使用路径类的cmdlets, 包括文件系统, 注册表,和证书供应程序.
 
如果需要为该命令提供多个参数, 请使用逗号进行分隔. 例如, "<parameter-name> <value1>, <value2>".
 
1
 
C:/PS>resolve-path ~ | format-list
 
字符 ~ 表示用户目录路径. 此例子将会返回用户目录全路径.
 
Drive: C
Provider : System.Management.Automation.ProviderInfo
ProviderPath : C:/Documents and Settings/username
Path : C:/Documents and Settings/username
 
2
 
C:/PS>resolve-path windows/*| format-list
 
此命令在当前目录执行并返回在目录Windows中的所有内容. 这个例子中, 这里只有一个结果显示. (译注: 你需要在C:/Documents and Settings/username/下创建windows及其子目录system才能看到结果.)
 
Drive: C
Provider : System.Management.Automation.ProviderInfo
ProviderPath : C:/Documents and Settings/username/windows/system
Path : C:/Documents and Settings/username/windows/system
 
3
 
C:/PS>resolve-path "C:/windows/*"| format-list
 
此例子显示目录C:/Windows并返回该路径名中的所有对象. 因为这里不是相对当前路径, 所以使用引号保护路径名. (译注: 不知道编写此文时, 为何得出这样结论, 实际上无需使用引号.)
 
Drive: C
Provider : System.Management.Automation.ProviderInfo
ProviderPath : C:/windows/addins
Path : C:/windows/addins
 
Drive: C
Provider : System.Management.Automation.ProviderInfo
ProviderPath : C:/windows/AppPatch
Path : C:/windows/AppPatch
 
Drive: C
Provider : System.Management.Automation.ProviderInfo
ProviderPath : C:/windows/assembly
Path : C:/windows/assembly
...
 
相关链接
Test-Path
Split-Path
Convert-Path
Join-Path
about_namespace
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值