如何通过清空命令提示符RECYCLEBIN? [英] how to empty recyclebin through command prompt?

查看:1378
本文介绍了如何通过清空命令提示符RECYCLEBIN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求。通常我们删除RECYCLEBIN通过右键内容点击鼠标并清空RECYCLEBIN。但我有,我需要删除RECYCLEBIN通过命令提示符下使用命令内容的要求。是否可以?如果是的话我怎么能实现呢?

I have a requirement. usually we delete recyclebin contents by right clicking the mouse and empty the recyclebin. but i have a requirement where i need to delete recyclebin contents using a command through command prompt. Is it possible? if so how can i achieve it?

推荐答案

您可以有效地空回收站通过永久删除包含系统文件的驱动器上的回收站目录中的命令行。 (在大多数情况下,这将是 C:驱动器,但你不应该硬code,它的价值,因为它不会永远是真正的相反,使用在%SYSTEMDRIVE%环境变量。)

You can effectively "empty" the Recycle Bin from the command line by permanently deleting the Recycle Bin directory on the drive that contains the system files. (In most cases, this will be the C: drive, but you shouldn't hardcode that value because it won't always be true. Instead, use the %systemdrive% environment variable.)

这是这个战术的作品的原因是因为每个驱动器都有一个隐藏的,受保护的文件夹的名称 $ RECYCLE.BIN ,这是在回收站实际存储删除文件和文件夹。当此目录被删除,Windows会自动创建一个新的目录。

The reason that this tactic works is because each drive has a hidden, protected folder with the name $Recycle.bin, which is where the Recycle Bin actually stores the deleted files and folders. When this directory is deleted, Windows automatically creates a new directory.

因此​​,删除目录,使用 RD 命令(研究的emove的 D 的irectory)与在 / S 参数,这表明所有的指​​定目录中的文件和目录也应被删除:

So, to remove the directory, use the rd command (r​emove d​irectory) with the /s parameter, which indicates that all of the files and directories within the specified directory should be removed as well:

rd /s %systemdrive%\$Recycle.bin

请注意,这个动作会的永久的目前在回收站中的从所有用户帐户删除所有文件和文件夹。此外,您将(显然)必须从提升的命令提示符,以便有足够的权限来执行此操作运行命令。

Do note that this action will permanently delete all files and folders currently in the Recycle Bin from all user accounts. Additionally, you will (obviously) have to run the command from an elevated command prompt in order to have sufficient privileges to perform this action.

这篇关于如何通过清空命令提示符RECYCLEBIN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆