当前位置:DOS资源站资料中心批处理教程 → 用批处理完全清除temp和tempor~1下的垃圾文件

用批处理完全清除temp和tempor~1下的垃圾文件

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2008-4-20 17:37:49

@echo off&title DOS资源站 www.cmdos.net
echo 下面开始清理IE上网产生的垃圾文件......
echo.
pause
del  /f /s /q "%userprofile%\locals~1\temp\*.*" >nul 2>nul
for /f "tokens=1 delims= " %%1 in ('dir /b  /a "%userprofile%\locals~1\temp"') do  erase /s /q /a "%userprofile%\locals~1\temp\%%1" >nul 2>nul
for /f "tokens=1 delims= " %%1 in ('dir /b  /a "%userprofile%\locals~1\temp"') do  rd /s /q  "%userprofile%\locals~1\temp\%%1" >nul 2>nul
for /f "tokens=1 delims= " %%1 in ('dir /b /a "%userprofile%\locals~1\tempor~1\"') do erase /s /q /a "%userprofile%\locals~1\tempor~1\%%1" >nul 2>nul
for /f "tokens=1 delims= " %%1 in ('dir /b /a "%userprofile%\locals~1\tempor~1\"') do rd /s /q "%userprofile%\locals~1\tempor~1\%%1" >nul 2>nul
echo.
echo 垃圾文件清理清理完毕......
echo ++++++++++++++++++++++++++++
pause

PS: 普通的 del /f /s /q 命令根本不可能删除这2个目录中的垃圾文件。所以自己改了一下~
     不知道有没有“闲人”和我一样质疑过这个问题~ 嘻,又修改了一下,感觉简洁了些~