Use batch command to delete files with specified suffix

I wrote a lot of C++ code and generated a lot of .exe files. Today I saw that the C drive became red. I want to delete all the .exe files generated after running the .cpp file. It is very simple to use the batch command

->First create a new del.txt file in the same folder where you want to delete the specified suffix file, of course, the name is arbitrary
-> enter the following command in the file

del /a /f /s /q "*.exe"
*为通配符
/a /f 是强制删除所有属性的文件
/q是无需确认直接删除
加上/s开关,就可以删除子文件加中的文件

Insert picture description here

->Delete the file in the specified path

del /a /f /s /q 绝对路径"*.文件后缀名"
del /a /f /s /q D:\C++"*.exe"

-> Change the suffix of the document to del.bat. Then double-click to run it

Guess you like

Origin blog.csdn.net/weixin_43311695/article/details/107991501