Image

Image

Search This Blog

Saturday, March 05, 2011

clear tempfiles for winXP

usually I call this script at shutdown, gpedit.msc is the name!


@echo off

::Set Search directory to "Documents and Settings" folder
(Set Target=%AllUsersProfile:~0,-10%)

title,Finding the Temp subfolders in %Target%&COLOR 9E

If EXIST "%Target%",(
For /f "Tokens=*" %%* in ('dir "%Target%" /B') Do (
cd /D "%target%\%%*\Local Settings\Temp" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%target%\%%*\Local Settings\Temp"
)
If EXIST "%Target%",(
For /f "Tokens=*" %%* in ('dir "%Target%" /B') Do (
cd /D "%target%\%%*\Local Settings\Temporary Internet Files" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%target%\%%*\Local Settings\Temporary Internet Files"
)
If EXIST "%Target%",(
For /f "Tokens=*" %%* in ('dir "%Target%" /B') Do (
cd /D "%target%\%%*\Local Settings\history\history.ie5" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%target%\%%*\Local Settings\history\history.ie5"
)
If EXIST "%Target%",(
For /f "Tokens=*" %%* in ('dir "%Target%" /B') Do (
cd /D "%target%\%%*\Application Data\Sun\Java\Deployment\cache" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%target%\%%*\Application Data\Sun\Java\Deployment\cache"
)
If EXIST "%Target%",(
For /f "Tokens=*" %%* in ('dir "%Target%" /B') Do (
cd /D "%target%\%%*\Local Settings\Application Data\Apple Computer\QuickTime\downloads" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md %target%\%%*\Local Settings\Application Data\Apple Computer\QuickTime\downloads
)
If EXIST "%Target%",(
For /f "Tokens=*" %%* in ('dir "%Target%" /B') Do (
cd /D "%target%\%%*\Application Data\Macromedia\Flash Player" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%target%\%%*\Application Data\Macromedia\Flash Player"
)
For /f "Tokens=*" %%* in ('dir "%SystemRoot%\Temp" /B') Do (
cd /D "%SystemRoot%\Temp" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%SystemRoot%\Temp"

For /f "Tokens=*" %%* in ('dir "%SystemRoot%\prefetch" /B') Do (
cd /D "%SystemRoot%\prefetch" && (
ATTRIB -S -H -R -A /D /S >nul & (
For /f "Tokens=*" %%* in ('dir /B') Do (
RD "%%*" /S /Q ||Del /F "%%*" )))>nul)
md "%SystemRoot%\prefetch"
exit

No comments:

Post a Comment

Blog Archive