How do I get only directories using Get-ChildItem?

You can use PowerShell cmdlet Get-ChildItem to get only the directory’s names. Here is a quick example for you –

This will get the first 10 directory names under C:\Windows directory

Leave a Reply