Batch file. Delete all files and folders in a directory

前端 未结 14 1357
无人共我
无人共我 2020-11-30 19:20

I want to have a batch file that will delete all the folders and files in my cache folder for my wireless toolkit.

Currently I have the following:

cd         


        
14条回答
  •  天涯浪人
    2020-11-30 19:33

    Use:

    • Create a batch file

    • Copy the below text into the batch file

      set folder="C:\test"
      cd /d %folder%
      for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
      

    It will delete all files and folders.

提交回复
热议问题