Windows 10 Quick Tip: Emptying Recycle Bin in Command-Line

We all know the easy way to empty the garbage out of the recycle bin on Windows. Right-click on the Recycle Bin on the desktop and simply choose Empty.

Can it be done through a command-line so it can be part of something like a scheduled job or login script?

Sure thing apparently. Run the following in an elevated command prompt window.

rd /s %systemdrive%$recycle.bin

Note that if you have more than drives in your system, you need to clean them up individually.

Now, if you are familiar with PowerShell, Clear-RecycleBin is your friend.

Clear-RecycleBin

The cmdlet alone will clear all the local computer’s recycle bins. And you need to run it in an elevated PowerShell window.

With the -force switch, you can suppress the confirmation if you want to.

Clear-RecycleBin -Force

And if you only want to clean up the recycle bin on a certain drive, use the -DriveLetter switch

Clear-RecycleBin -DriveLetter D

Here is a bonus tip: how to open the recycle bin from a command line.

Start Shell:RecycleBin

The post Windows 10 Quick Tip: Emptying Recycle Bin in Command-Line appeared first on Next of Windows.