Recently I faced a situation where I had to empty the recycle bin from Windows command line(CMD). After doing some search on this topic, I found that there is no command for cleaning up recycle bin. Also recycle bin is not a folder like all other folders. I have no idea where the items in the recycle bin really get stored. Otherwise, running del command on that folder would have worked. Finally I got a solution by using cleanmgr utility.
Cleanmgr is a GUI based utility but it has two interesting options /sageset and /sagerun. Using these two options we can clean up recycle bin from command prompt. You can find the steps below.
- First run the command ‘cleanmgr /sageset:1‘ either from command prompt or from Run window.
- Now in the clean manager window select Recycle bin and unselect every other category.
- Click on OK.
- Now onwards whenever you want to empty recycle bin, you can simply run the command ‘cleanmgr /sagerun:1‘ from windows command prompt.