PowerTip: Use PowerShell 5 to Clear Recycle Bin

Summary: Learn how to clear the recycle bin by using Windows PowerShell 5.0 in Windows 10.

Hey, Scripting Guy! Question How can I use Windows PowerShell to clear the recycle bin in my laptop running Windows 10?

Hey, Scripting Guy! Answer Use the Clear-RecycleBin cmdlet.

Comments (9)

  1. mmuffins says:

    Is there a way to use this cmdlet to clear the recycle bin for other users? Whenever one of our servers has a low disk space alert I usually connect there and run rd /s c:$Recycle.Bin, just in case.

    This actually has a surprisingly high success rate to resolve these alerts.

  2. ed wilson says:

    you cannot run it and target another persons recycle bin, but it might be possible to include it in a logon script, or to create a scheduled task for the user that would run. It is a great idea for a future blog article.

  3. HicanNL says:

    Now that is a nice feature! I always remove all icons from my desktop, including the recycle bin. With this one-liner it’s easy to keep it empty 🙂

  4. Brad_Voris says:

    Pretty slick thanks!

  5. Ed O'Brien says:

    How do I create a script to empty recycle bin on shutdown Windows 10??

  6. Brad_Voris says:

    You could use something like this:
    $Recycler = (New-Object -ComObject Shell.Application).NameSpace(0xa)
    $Recycler.items() | foreach { rm $_.path -force -recurse }

    have a scheduled task with a trigger on disconnect from a user session.

  7. Jaap Brasser says:

    Nice blog post, I wrote a small function that allows to view the contents of the Recycle Bin as well, it is available here:

  8. Brad_Voris says:

    Nice! your cmdlet is backwards compatible to PowerShell 2.0 🙂

  9. Lax.rawat007 says:

    You can empty the recycle bin using below command in windows 10
    powershell commad = “powershell.exe -command clear-recyclebin –Force”

    you can create a shortcut which can hold this command so when you run Created shortcut it will clean recycle bin.
    Follow below video for more information.


Skip to main content