Emptying the contents of the recycle bin becomes way easier in Powershell. A single command from the Powershell session wipes off the content of recycle bin.
You could use a command that takes a confirmation approval. Or, you could force the command to clear the recycle bin without any confirmation.
We will look at the different commands that are available to use for deleting recycle bin contents on a permanent basis.
Empty recycle bin in Powershell without confirmation
You can empty the recycle bin using Powershell and the following command will ensure that no confirmation is sought before the recycle bin is emptied.
The Clear-RecycleBin command with the ‘Force’ switch will remove all files from the recycle bin without any confirmation being sought. It is a one-step command that will clear the recycle bin in an effective way.
There is no specific output of this command. The command gives no confirmation about the deletion of recycle bin files. You would need to manually validate the recycle bin to see if the files have been cleared from the recycle bin.
When you type the command, the recycle bin is cleared and Powershell returns to the command prompt as given in the screenshot.
Empty recycle bin with confirmation in Powershell
If you prefer to use a Powershell cmdlet that also seeks your confirmation before clearing the recycle bin, you can use the Clear-Recyclebin cmdlet without any switch or option. So, the command looks like the one below:
The screenshot below represents the output of this command. You can see the confirmation message that pops up on the Powershell screen. Once you confirm the operation, the recycle bin will be emptied.
Empty recycle bin for specific drives in Powershell
Recycle bin can be cleared on a drive-by-drive basis. So, Powershell allows you to empty recycle bin for specific drives based on the drive letters. For example, we will use the Clear-RecycleBin cmdlet to remove files from the recycle bin for D:\ in the command below.
The command above will remove all files from D: that are in the recycle bin. In this command, you will also be asked for confirmation. The screenshot below represents the output of this command in Powershell.
Clear-RecycleBin cmdlet is used to empty recycle bin files on a Windows computer. You could use the command in multiple ways to clear the recycle bin with or without confirmation.
Suggested Powershell Tutorials
You may like to read more Powershell tutorials for Windows computers and various tasks that you can execute on a Windows computer below.
- How to find CPU utilization using Powershell
- How to find free disk space in Powershell?
- How to find Windows Update history using Powershell?
- How to concatenate strings in Powershell?
- How to read a text file using Powershell?
- How to find TPM version of a computer using Powershell?
- Check TPM on Windows computer using Powershell
- Use Powershell to find all files over a certain size
- How to kill a process in Powershell on Windows computers?
- Battery report of Windows computer using Powershell
- How to find MAC address in Powershell?
- How to find network adapter details in Powershell?
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
Rajesh Dhawan is a technology professional who loves to blog about smart wearables, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.