Is it possible in Windows to get a folder\'s size from the command line without using any 3rd party tool?
I want the same result as you would get when right clicking
Here comes a powershell code I write to list size and file count for all folders under current directory. Feel free to re-use or modify per your need.
$FolderList = Get-ChildItem -Directory
foreach ($folder in $FolderList)
{
set-location $folder.FullName
$size = Get-ChildItem -Recurse | Measure-Object -Sum Length
$info = $folder.FullName + " FileCount: " + $size.Count.ToString() + " Size: " + [math]::Round(($size.Sum / 1GB),4).ToString() + " GB"
write-host $info
}