Clear-RecycleBin
Clears the contents of the current user's recycle bin.
Clear-RecycleBin
[[-DriveLetter] <String[]>]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
This cmdlet is only available on the Windows platform.
The Clear-RecycleBin
cmdlet deletes the content of the current user's recycle bin. This action is
like using Windows Empty Recycle Bin.
This cmdlet was readded in PowerShell 7.
In this example, the current user's recycle bins for all drives are cleared.
Clear-RecycleBin
Confirm
Are you sure you want to perform this action?
Performing the operation "Clear-RecycleBin" on target "All of the contents of the Recycle Bin".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Clear-RecycleBin
prompts the user for confirmation.
This example clears the recycle bin for a specified drive letter.
Clear-RecycleBin -DriveLetter C
Clear-RecycleBin
uses the DriveLetter parameter to specify the recycle bin on the C
volume. The user is prompted for confirmation to run the command.
This example doesn't prompt for confirmation to clear the recycle bins.
Clear-RecycleBin -Force
Clear-RecycleBin
uses the Force parameter and doesn't prompt the user for confirmation to
clear all recycle bins.
An alternative is to replace -Force
with -Confirm:$false
.
Prompts for user confirmation before running the cmdlet. The user is prompted for confirmation even if the Confirm parameter isn't specified.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the recycle bin to clear for a single drive letter or an array of drive letters.
Type: | String[] |
Position: | 0 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies that the user isn't prompted for confirmation to clear a recycle bin. The Force parameter also overrides the WhatIf and Confirm parameters.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Shows what would happen if Clear-RecycleBin
runs. The cmdlet isn't run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
None
This cmdlet returns no output.
This cmdlet is only available on Windows platforms.
PowerShell feedback
PowerShell is an open source project. Select a link to provide feedback: