PowerShell: Empty the Recycle Bin
Need to empty the Recycle Bin - as part of a cleanup script, freeing up disk space, or routine maintenance? This one-liner clears it directly from the terminal.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Clear-RecycleBin -Confirm:$false
This permanently deletes everything currently in the Recycle Bin - there's no further undo once it's cleared. Make sure nothing important is sitting in there before running it.
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Clear-RecycleBin empties the Recycle Bin for all drives on the machine.
- -Confirm:$false skips the confirmation prompt that would otherwise appear before deleting - useful for scripts that need to run without manual interaction.