PowerTip: Clear Recycle Bin with PowerShell 5

Summary: Easily purge the Recycle Bin on a targeted drive with PowerShell 5.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily flush out the Recycle Bin?

Hey, Scripting Guy! Answer In Windows PowerShell 5.0, use the Clear-RecycleBin cmdlet. For example, run the
           following command with elevated rights to purge the Recycle Bin on drive C:

Clear-RecycleBin –DriveLetter C -force

Comments (2)

  1. Maarten Vekens says:

    When you use this command will everything be removed? also content deleted by other users? Now I use treesize to remove this.

  2. Sean Kearney says:

    @Maarten Vekens

    It is localized to the User’s recycle bin. But here’s a trick I have been doing for quite a while. I just Remove the Hidden folder on the Root of the C drive called $Recycle.Bin to purge all recycle Bins on a drive.

    Remove-Item -path ‘C:$Recycle.bin’ -recurse -force -confirm:$False

    Honorary Scripting Guy

Skip to main content