To empty the Recycle Bin through the Command Prompt in Windows, you can use a PowerShell command, as there is no direct built-in Command Prompt command to empty the Recycle Bin. However, you can execute PowerShell commands from the Command Prompt.
Method 1: Using PowerShell from Command Prompt
- Open Command Prompt (CMD).
- To empty the Recycle Bin for all drives, enter the following PowerShell command:
powershell.exe -Command "Clear-RecycleBin -Force -Confirm:$false"
-Force
: This bypasses any confirmation prompts.-Confirm:$false
: This prevents any confirmation message from being shown before clearing the Recycle Bin.
Method 2: Using a Script to Empty Recycle Bin
If you want to create a reusable batch file or script to empty the Recycle Bin, you can create a PowerShell script file (.ps1
) with the following content:
- Open Notepad and add the following script:
Clear-RecycleBin -Force -Confirm:$false
- Save the file as
EmptyRecycleBin.ps1
(ensure the file extension is.ps1
). - You can then execute this script from PowerShell or Command Prompt by running:
powershell.exe -ExecutionPolicy Bypass -File C:\path\to\EmptyRecycleBin.ps1
This will run the script and empty the Recycle Bin.
Method 3: Using Third-Party Tools (Optional)
Alternatively, there are third-party tools like CCleaner that can be used to clear the Recycle Bin and perform system cleanup via command-line options. However, for basic tasks, PowerShell is the built-in method recommended by Microsoft.
Conclusion:
The most straightforward way to empty the Recycle Bin from the command line in Windows is by invoking a PowerShell command from Command Prompt. This method is simple and doesn’t require any third-party tools.