Clear-RecycleBin
清除当前用户的回收站的内容。
语法
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 |
别名: | cf |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DriveLetter
指定要清除单个驱动器号或驱动器号数组的回收站。
类型: | String[] |
Position: | 0 |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Force
指定不会提示用户确认清除回收站。 Force 参数还替代 WhatIf 和 Confirm 参数。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 Clear-RecycleBin
运行时会发生什么情况。 该 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输出
None
此 cmdlet 不返回任何输出。