Tired of cleaning up the Recycle Bin manually on your Windows desktop? Here is a pretty cool tip to automate this process. Thanks to Winaero for sharing it.
Command used to empty the bin
You can use either Windows command-line like this
rd /s %systemdrive%$Recycle.bin
or PowerShell cmdlet like below.
Clear-RecycleBin
Since the Windows command needs local admin privilege to run and needs to specify the location of the Recycle bin to run, we will just use the PowerShell cmdlet in this case.
To empty during startup
Open Startup folder by launching the following shell command in the Run dialog box.
shell:startup
And right-click inside the folder to create a new shortcut named “Empty Recycle Bin” with the following command in the Target box.
cmd.exe /c "echo Y|PowerShell.exe -NoProfile -Command Clear-RecycleBin"
That’s it. The recycle bin will be emptied out every time you log into your computer.
Behind the scene, what it does is to call out the Command Prompt to launch PowerShell to execute the cmdlet Clear-RecycleBin with an Echo Y to answer Y to the prompt. Pretty simple and clever.
Note that the command mentioned above will remove all files and folders currently in the Recycle Bin from all user accounts regardless of the physical location of the recycle bin.
To schedule a job
If doing so during the Startup isn’t your option, you can use Windows built-in Task Scheduler to make a more flexible task to do the job.
Open Task Scheduler, start to create a new task in Task Scheduler Library.
First of all, give a name in General tab. In this case, we can call it as “Empty Recycle Bin.”
Then, create a trigger of your choice in Triggers tab. There are a lot of options to choose from.
Then create a new action in Actions tab, put “cmd.exe” in Program/script box and the following command in “Add arguments” box.
/c "echo Y|PowerShell.exe -NoProfile -Command Clear-RecycleBin"
Click OK to save the setting. And it’s done.