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

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

问题描述

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

是否有为此预先构建的工具,还是我需要编写一个?

DEL/S 不会删除目录.

DELTREE 已从 Windows 2000+ 中删除

解决方案

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

rd/s/q "路径"

<块引用>

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

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

/S 除目录本身外,还删除指定目录中的所有目录和文件.用于删除目录树.

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

如果您使用 PowerShell,则可以使用 Remove-Item(别名为 deleraserdrirmrmdir) 并接受一个 -Recurse 参数,该参数可以缩写为 -r

rd -r "路径"

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 doesn't delete directories.

DELTREE was removed from Windows 2000+

解决方案

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

rd /s /q "path"

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

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

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

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

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天全站免登陆