Changing the world one-liner at a time.
dir | where {$_.PsIsContainer}
Alternatively you could:
dir |where {$_.mode -match "d"}
Jeffrey SnoverWindows PowerShell Architect
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using RSS
This is ~one~ of my biggest gripes against powershell:
get-childitem | where {$_.mode -match "d"}
versus
dir /AD
One of them is quick and efficient to type; the other tedious, wordy, aggravating.
If everyone has to alias everything just to work efficiently on a command line, then really: what benefit is the overly-lengthy Verb-Noun syntax coupled with long switches ("silentlycontinue"?!)?
As a system admin who can also program in a handful of languages, I feel Powershell lost sight of being a command line interface for SAs.
I agree with Eric. There should be some shortcuts or something. I'm having trouble getting a certain property from a directory after doing this... should be simpler. I know it can be done, but why does it have to be so complicated?