Clear-RecycleBin
清除回收站的内容。
语法
All
Clear-RecycleBin
[[-DriveLetter] <String[]>]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Clear-RecycleBin cmdlet 删除计算机回收站的内容。 此操作类似于使用 Windows 空回收站。
示例
1:清除所有回收站
在此示例中,清除了所有本地计算机的回收站。
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 提示用户确认清除本地计算机上的所有回收站。
2:清除指定的回收站
此示例清除指定驱动器号的回收站。
Clear-RecycleBin -DriveLetter C
Clear-RecycleBin 使用 DriveLetter 参数在 C 卷上指定回收站。 系统会提示用户确认以运行命令。
3:在未确认的情况下清除所有回收站
此示例不提示确认清除本地计算机的回收站。
Clear-RecycleBin -Force
Clear-RecycleBin 使用 Force 参数,并且不会提示用户确认清除本地计算机上的所有回收站。
替代方法是将 -Force 替换为 -Confirm:$false。
参数
-Confirm
在运行 cmdlet 之前提示用户确认。 即使未指定 Confirm 参数,也会提示用户进行确认。
参数属性
| 类型: | SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | cf |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DriveLetter
指定要清除单个驱动器号或驱动器号数组的回收站。
参数属性
| 类型: | String[] |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 0 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Force
指定不会提示用户确认清除回收站。
参数属性
| 类型: | SwitchParameter |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-WhatIf
显示 Clear-RecycleBin 运行时会发生什么情况。 cmdlet 未能运行。
参数属性
| 类型: | SwitchParameter |
| 默认值: | False |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | 无线 |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。