且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除使用Windows中的一个bat文件所有内容的文件夹?

更新时间:2022-11-17 19:50:14

  @RD / S / QD:\\ PHP_Projects \\ testproject \\发布\\ testfolder

说明:


  

移除(删除)的目录。

  RMDIR [/ S] [/ Q] [盘符:]路径RD [/ S] [/ Q] [盘符:]路径/ S删除指定目录下的所有文件和目录
        除了目录本身。用于删除目录
        树。/ Q安静模式,不要求确认删除目录树/ S


块引用>

I want to delete a folder with all files and subfolders using a bat file.

I have tried the following, but it is not working:

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

Can anybody help?

@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