Empty Recycle Bin Automatically Using Task Scheduler or Storage Sense

You can use it to clear the Recycle Bin at a specified time or regular intervals with Task Scheduler using a PowerShell command. Alternately, you can also use Storage Settings (a.k.a. Storage Sense) to clear the files from Recycle Bin that are older than a certain number of days.

This article discusses the two methods to clear the Recycle Bin automatically at predefined intervals.

How to Automatically Empty the Recycle Bin in Windows 10

Method 1: Using Storage Sense

The Windows 10 Storage Settings has a feature which lets you delete files in the Recycle Bin that are older than “x” days.

  1. Open Settings, System, Storage
  2. Enable the radio-button near the option “Storage can automatically free up space…” under Storage.
    empty recycle bin - storage settings or storage sense
  3. Click Configure Storage Settings or run now. This opens the configuration page where you can choose the items you want to automatically delete using Storage Sense.
  4. Under Delete files in my Recycle Bin if they have been there for over, choose one of the options listed. In Windows 10 v1903, this option provides you 5 choices, namely: “Never”, “1 day”, “14 days”, “30 days”, “60 days”. Choose one of the options as required.
    empty recycle bin - storage settings or storage sense

That’s it. The Storage Sense will automatically delete older files in your Recycle Bin.

Method 2: Using a PowerShell command with Task Scheduler

As you know, PowerShell has a built-in cmdlet to clear the Recycle Bin automatically using the following command, which you can also automate with Task Scheduler.



powershell.exe -command Clear-RecycleBin -Force

Running PowerShell.exe from Task Scheduler would display the PowerShell window every time the task runs. To avoid that, you can run the above command in hidden mode by launching it with a VBScript.

  1. Create a VBScript from the following contents. To do so, copy the following contents to Notepad and save the file with .vbs extension — e.g. EmptyBin.vbs
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "powershell.exe" & " -command Clear-RecycleBin -Force", 0, 0
    Set WshShell = Nothing

    Optionally, you may move the VBScript file to your Windows directory if required. The next step is to create a scheduled task to run the above script to empty the Recycle Bin at required intervals.

  2. Open Task Scheduler, and click Create a Task… in the Actions pane.
  3. Type the name of the task and assign a description.
    empty recycle bin task scheduler
  4. Click the Triggers tab, and click New.
  5. In the “Begin the task:” drop-down box, select an option from the list. In this example, I chose to run the task At log on, by any user in the system.
    empty recycle bin task scheduler
  6. Click OK. Select the Actions tab, and click New
  7. In the Program/Script: text box, type the following:
    C:\Windows\System32\Wscript.exe
  8. In the Add arguments (optional): text box, type:
    C:\Windows\EmptyBin.vbs

    empty recycle bin task scheduler

  9. Click OK, OK.

That’s all. The Recycle Bin should be cleared automatically at every log on, or at the specific time intervals if you’ve set any.

Note: Earlier versions of PowerShell don’t include the Clear-RecycleBin cmdlet. In that case, you may either upgrade PowerShell or use the excellent NirCmd command-line automation tool to clear the Recycle Bin silently.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right here. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Leave a Comment