April 22nd, 2014

PowerTip: Find Largest File in User Profile with PowerShell

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to find the largest file in your user profile.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the largest file in my user profile?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet (dir is an alias for the Get-ChildItem), do a recursive search
          of your user profile directory, then sort the files by size and select the last file:

dir $env:USERPROFILE -Recurse -File | sort length | select -last 1

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.