windows - 如何在 Windows 中使用 bat 文件删除文件夹和所有内容?

标签 windows batch-file command delete-file

我想使用 bat 文件删除包含所有文件和子文件夹的文件夹。

我已经尝试了以下方法,但它不起作用:

@DEL D:\PHP_Projects\testproject\Release\testfolder*.*

有人可以帮忙吗?

最佳答案

@RD /S /Q "D:\PHP_Projects\testproject\Release\testfolder"

Explanation :

Removes (deletes) a directory.

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

关于windows - 如何在 Windows 中使用 bat 文件删除文件夹和所有内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7331056/

相关文章:

java - 忽略编译错误 - Java

windows - 使用 Wix 安装程序将快捷方式添加到开始菜单程序中的子文件夹

windows - 通过命令行添加系统路径环境变量?

batch-file - 如何为命令答案创建批处理变量=?

windows - Tomcat如何将其可执行文件设置为Windows服务?

python - 如何在 Python 中创建漂亮的 shell 命令包装器

windows - 通过 CMD 批处理文件卸载 Windows 更新

python - 从同一个批处理文件中读取第一行批处理文件?

c++ - 如何设置 CreateFile() 打开 COM 端口时将使用的 DTR/RTS 状态

Symfony2 自定义控制台命令在执行时显示为 "not defined"