powershell - Test-Path-叶意义

标签 powershell

我正在学习 PowerShell 并在 Technet 上看到它的使用:

Test-Path -Path $DirectoryPath -PathType 'Leaf'

路径类型Leaf是什么意思?

很清楚什么是ContainerAny路径类型

最佳答案

来自 Test-Path 帮助:

-PathType <TestPathType>
    Specifies the type of the final element in the path. This cmdlet returns $True if the element is of the specified
    type and $False if it is not. The acceptable values for this parameter are:

    - Container. An element that contains other elements, such as a directory or registry key. - Leaf. An element that
    does not contain other elements, such as a file. - Any. Either a container or a leaf. Tells whether the final
    element in the path is of a particular type.

具体来说:

-Leaf. An element that does not contain other elements, such as a file.

从控制台获取此信息的最简单方法是 Get-Help Test-Path -Parameter PathType

关于powershell - Test-Path-叶意义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48262339/

相关文章:

powershell - AWS Cloudfront 文件通过 REST API 和 Powershell 失效

Powershell 捕获调用命令输出

sharepoint - 获取sharepoint farm中的所有机器

powershell - 如何在powershell的Invoke-RestMethod中转换curl命令

Powershell - 使用多维数组存储数据 - 需要建议

arrays - 查找数组中的重复项

php - 将多个 csv 文件组合在一起,并在连接期间添加一列

Powershell:将对象[]输出到文件

powershell - 在网络驱动器上的 .msg 文件中搜索关键字

Powershell 模块 GUID