PowerShell: Permanently Delete a File
Need to delete a file permanently, bypassing the Recycle Bin entirely - for cleanup scripts or removing sensitive data? This one-liner does exactly that, without any extra parameters needed.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Remove-Item -Path "C:\path\to\file.txt"
Unlike deleting a file through File Explorer, this bypasses the Recycle Bin completely - the file is gone immediately with no undo option. Double-check the path 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:
- Remove-Item deletes files (and folders) permanently by default - unlike deleting through File Explorer's GUI, which sends items to the Recycle Bin first, Remove-Item skips that step entirely and removes the file directly from disk.
- No special parameter is needed to force permanent deletion - this is simply the default behavior of the cmdlet.