2017-07-25 124 views

回答

1
$dir = '.' # specify the directory to investigate 
$hasAnySubdir = (Get-ChildItem -Force -Directory $dir).Count -gt 0 

-Directory(PSv3 +)确保Get-ChildItem只枚举子目录,和-Force确保即使隐藏子目录都包括在内。

相关问题