June 23rd, 2006

Windows PowerShell One-Liner: List all the subdirectories in the current directory

PowerShell Team
PowerShell Team

dir | where {$_.PsIsContainer}

Alternatively you could:

dir |where {$_.mode -match “d”}

Jeffrey Snover
Windows PowerShell Architect

Category
PowerShell

Author

PowerShell Team
PowerShell Team

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

0 comments

Discussion are closed.