Get all child folders with PowerShell

The commandlet ‘Get-ChildItem’ will give you all the default information about the folders inside. By default they are: Mode, LastWriteTime, Length (for files) and Name.

Get-ChildItem c:\Path

If you want to achieve only the names, you should use the command like this:

Get-ChildItem -Directory | Select-Object Name

To store the data to a file, use something like this:

Get-ChildItem -Directory | Select-Object Name > result.txt

Leave a Reply

Your email address will not be published. Required fields are marked *