“ rm -rf”相当于Windows? [英] "rm -rf" equivalent for Windows?

查看:934
本文介绍了“ rm -rf”相当于Windows?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种递归删除文件夹及其子级的方法。

I need a way to recursively delete a folder and its children.

是否为此目的使用了预先构建的工具,还是需要编写一个工具?

Is there a prebuilt tool for this, or do I need to write one?

DEL / S 不会删除目录。

DELTREE 已从Windows 2000+中删除

DELTREE was removed from Windows 2000+

推荐答案

RMDIR或RD(如果您是使用经典的命令提示符(cmd.exe):

RMDIR or RD if you are using the classic Command Prompt (cmd.exe):

rd /s /q "path"




RMDIR [/ S] [/ Q] [驱动器:]路径

RMDIR [/S] [/Q] [drive:]path

RD [/ S] [/ Q] [drive:] path

RD [/S] [/Q] [drive:]path

/ S还将删除指定目录中的所有目录和文件到目录本身。 用于删除目录树。

/S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree.

/ Q安静模式,不要问是否可以使用/ S删除目录树

/Q Quiet mode, do not ask if ok to remove a directory tree with /S

如果使用PowerShell,则可以使用 Remove-Item (别名为 del 删除 rd ri rm rmdir )并进行-递归可以缩写为 -r

If you are using PowerShell you can use Remove-Item (which is aliased to del, erase, rd, ri, rm and rmdir) and takes a -Recurse argument that can be shorted to -r

rd -r "path"

这篇关于“ rm -rf”相当于Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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