
CODE: [Copy to clipboard][ Last edited by namejm on 2007-1-8 at 12:09 AM ]@echo off
:: 把本脚本放在D盘之外的分区执行
for /f "delims=" %%i in ('dir /a /b d:') do (
if not "%%i"=="游戏" (rd /s /q "d:\%%i" 2>nul||del /a /f /q "d:\%%i")
)
CODE: [Copy to clipboard]config.ini文件保存的是不希望被删除的目录,一行一条记录,行的首尾不能有任何多余的字符。另外,因为findstr在匹配整行的时候有个小bug,所以要求最后一行必须为空行,举例如下:@echo off
:: 把本脚本放在D盘之外的分区执行
for /f "delims=" %%i in ('dir /a /b d:') do (
findstr /b /e /c:"%%i" config.ini>nul||(rd /s /q "d:\%%i" 2>nul||del /a /f /q "d:\%%i")
)
CODE: [Copy to clipboard][ Last edited by namejm on 2007-1-8 at 12:09 AM ]Program files
sys
temp
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |