基本上我需要删除所有临时文件,并且我有以下脚本。由于所有位置都是硬编码的并且并非所有人都使用默认位置,我想知道是否有人可以帮助我使用与当前脚本兼容的脚本,该脚本将从每个存在的配置文件中检测所有“Temporary Internet Files”文件夹的位置并删除不需要的。 解决方案将是一个很大的帮助。
来源:http://www.expertsexchange.com/OS/Microsoft_Operating_Systems/Windows/2000/Q_20794666.html
CODE:
cls
SET SRC1=%SYSTEMDRIVE%\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files
SET SRC3=Local Settings\Temp
SET SRC4=Local Settings\History
SET SRC5=%SYSTEMROOT%\Temp
SET SRC6=Cookies
echo About to delete files from Internet Explorer "Temporary Internet files"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
echo About to delete files from "Local settings\temp"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC3%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR %%Y IN ("%%X\%SRC3%\*.*") DO DEL /F /S /Q "%%Y"
echo About to delete files from "Windows\Temp"
cd\
%systemdrive%
cd /d %SystemRoot%\temp
del /F /Q *.*
@echo Y|RD /S ""
@echo.
@echo.
echo About to delete files from "Local Settings\History"
FOR /D %%X IN ("%SRC1%\*") DO FOR %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR %%Y IN ("%%X\%SRC4%\today*.*") DO DEL /F /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"
echo About to delete files from "%SYSTEMROOT%\Temp"
FOR /D %%X IN ("%SRC1%\*") DO FOR %%Y IN ("%%X\%SRC5%\*.*") DO DEL /F /S /Q "%%Y"
echo About to delete files from "Cookies"
FOR /D %%X IN ("%SRC1%\*") DO FOR %%Y IN ("%%X\%SRC6%\*.*") DO DEL /F /S /Q "%%Y"
@echo Please review any errors if they exist
@echo.
@echo.
答案 0 :(得分:1)
尝试以下脚本...但我不确定用户配置文件选择...
del /q /s "c:\winnt\temp\*.*"
del /q /s "c:\windows\temp\*.*"
del /q /s "%USERPROFILE%\Local Settings\Temp\*.*"
del /q /s "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*"
del /q /s "%USERPROFILE%\Cookies\*.*"
del /q /s "%USERPROFILE%\Recent\*.*"
Rmdir /q /s "%USERPROFILE%\Local Settings\Temporary Internet Files"
Rmdir /q /s "%USERPROFILE%\Local Settings\Temp"
Rmdir /q /s "%USERPROFILE%\Cookies\*.*"
Rmdir /q /s "c:\winnt\Temp"
Rmdir /q /s "c:\windows\Temp"
md "%USERPROFILE%\Local Settings\Temporary Internet Files"
md "%USERPROFILE%\Local Settings\Temp"
md "%USERPROFILE%\Cookies"
md "c:\winnt\Temp"
md "c:\windows\Temp"