Windows 如何检查Powershell中的目录是否包含其他目录?
我正在powershell中寻找一种简单(如果可能)的方法来检查一个目录是否包含至少一个其他目录Windows 如何检查Powershell中的目录是否包含其他目录?,windows,powershell,directory,Windows,Powershell,Directory,我正在powershell中寻找一种简单(如果可能)的方法来检查一个目录是否包含至少一个其他目录 $dir = '.' # specify the directory to investigate $hasAnySubdir = (Get-ChildItem -Force -Directory $dir).Count -gt 0 -Directory(PSv3+)确保Get ChildItem仅枚举子目录,而-Force确保甚至包含隐藏的子目录
$dir = '.' # specify the directory to investigate
$hasAnySubdir = (Get-ChildItem -Force -Directory $dir).Count -gt 0
-Directory
(PSv3+)确保Get ChildItem
仅枚举子目录,而-Force
确保甚至包含隐藏的子目录