How to empty recycle bin with Powershell?

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.

Clear-RecycleBin -Force

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.

Clear-RecycleBin Force command to empty recycle bin.

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:

Clear-RecycleBin

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.

Clear Recycle Bin with confirmation messages in Powershell.

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.

Clear-RecycleBin D:

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 Recycle Bin drive basis

Summary

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 useful was this post?

Click on a star to rate it!

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

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.