Notes 2 Myself
to remember…
Windows PowerShell – cmd to find top 10 largest files on system
Posted by on November 20, 2011
@echo off
Powershell -noexit "Get-PSdrive | where { $_.Used -gt 0 } | foreach { Get-ChildItem $_.Root -recurse -force -ErrorAction SilentlyContinue | Select Name,DirectoryName, @{Label='Size';Expression={($_.Length/1GB).ToString('F04')}} | Sort Size -descending | select -first 10}"
Advertisement