@echo off
set All=0
if not '%1' == '' goto _loop
echo.
echo Purging current directory ...
echo Are you sure you want to purge current directory?
choice.exe /C YNQ /M "Press Y for Yes, N for No, Q for Quit."
if errorlevel 2 goto _quit
for /D %%D in (*.*) do @rd /s /q "%%D"
del /f /q .
echo.
echo Purge current directory done!
dir
goto _quit
:_loop
if '%1'=='' goto _quit
if not "%All%"=="0" goto _go
echo.
echo Purging directory %1 ...
echo Are you sure you want to purge directory: %1?
choice.exe /C YNAQ /M "Press Y for Yes, N for No, A for All directory, Q for Quit."
if errorlevel 4 goto _quit
if errorlevel 3 goto _all
if errorlevel 2 goto _next
if errorlevel 1 goto _go
:_all
set All=1
goto _go
:_go
for /D %%D in (%1\*.*) do rd /s /q "%%D"
del /f /q %1\.
echo.
echo Purge directory %1 done!
dir %1
goto _next
11楼的太复杂了,看不懂。
奇怪为什么我清楚98里面的可以成功,xp里面的却说系统找不到文件,请看下下面我在网上下载的批处理改编的:
@echo off
echo 正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %windir%\*.log
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
del /f /q %userprofile%\cookies\*.*
del /f /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
for /d %%i in (%userprofile%\Local Settings\Temp\*) do @rd /s /q "%%i"
del /f /s /q %userprofile%\Local Settings\Temp\*.*
for /d %%i in (%windir%\temp\*) do @rd /s /q "%%i"
del /f /s /q %windir%\temp\*.*
for /d %%i in (%systemdrive%\recycled\*) do @rd /s /q "%%i"
del /f /s /q %systemdrive%\recycled\*.*
for /d %%i in (%userprofile%\recent\*) do @rd /s /q "%%i"
del /f /s /q %userprofile%\recent\*.*
for /d %%i in (%userprofile%\NetHood\*) do @rd /s /q "%%i"
del /f /s /q %userprofile%\NetHood\*.*
echo 清除系统LJ完成!
echo.
pause
98下我试验成功的:
@echo off
echo 正在清除Win98垃圾文件,请稍等......
for /d %%i in (C:\WINDOWS\TEMP\*) do @rd /s /q "%%i"
del /f /s /q C:\WINDOWS\TEMP\*.*
del /f /s /q C:\WINDOWS\Recent\*.*
echo 清除系统LJ完成!
echo.
pause