Clear-RecycleBin

Clears the contents of a recycle bin.

Syntax

Clear-RecycleBin
     [[-DriveLetter] <String[]>]
     [-Force]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]

Description

The Clear-RecycleBin cmdlet deletes the content of a recycle bin. Running this cmdlet is equivalent to the "Empty Recycle Bin" action.

Examples

1: Clear all recycle bins

PS C:\> Clear-RecycleBin

This command will clear all recycle bins present on the local computer. the command will prompt for user confirmation before execution.

2: Clear single recycle bin

PS C:\> Clear-RecycleBin -DriveLetter C

This command will clear the recycle bin on the volume with the C drive letter. This command will not work on The command will prompt for user confirmation before execution.

3: Clear all recycle bins without confirmation

PS C:\> Clear-RecycleBin -Force

This command will clear the recycle bin on the volume with the C drive letter. The command will NOT prompt for user confirmation before execution.

3: Clear all recycle bins without confirmation (alternative)

PS C:\> Clear-RecycleBin -Confirm:$false

This command will clear the recycle bin on the volume with the C drive letter. The command will NOT prompt for user confirmation before execution.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-DriveLetter

Specifies an array of drive letters for which this cmdlet clears the recycle bin.

Type:String[]
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False