发表时间:2011-04-22来源:网络
文件是只读属性,只有一个文件夹和一个文件不删,其它的都要删除。
假设指定的文件夹和文件分别是 e:hello e:world.mp3
for /f "tokens=*" %%i in ('dir /s /b e:') do (if not "%%i"=="e:hello"
if not "%%i"=="e:world.mp3" del /f /s /q "%%i" & rd /s /q "%%i")
rem 会删除d盘中除e:hello e:world.mp3外的所有文件
rem 以上代码保存为.bat文件运行
2011-02-15
2011-02-13
2011-02-12
2011-02-12
2011-02-14
2011-02-15
2011-02-12
2011-02-13
2024-05-13
2011-02-13