powershell: retrieving directories in the current path

hard -- obscure if you don't know the calls, aren't familiar with programming (basically, me)

[io.directory]::GetDirectories($(get-location))


medium -- not so bad when you know what to look for

get-childitem | where-object { $_.mode -eq "D----" }
get-childitem | where-object { $_.PSISContainer -eq $true }
get-childitem | where-object { $_.Attributes -eq 'Directory' }


easy -- at least there's no bracketing or positional parameters to worry about

get-childitem | where-object psiscontainer -eq $true


easiest -- near parity with cmd shell, provided you use shortcuts

get-childitem -directory

Comments