我正在学习 PowerShell 并在 Technet 上看到它的使用:
Test-Path -Path $DirectoryPath -PathType 'Leaf'
路径类型Leaf
是什么意思?
很清楚什么是Container
和Any
路径类型
最佳答案
来自 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/