|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by bsharath in Programming Languages, Scripting Languages, Windows Batch Scripting
Hi,
Temp files deletetion script does not clear all profiles and all temp folders.
sedgwick has given me this code.
it does not clear all and every temp folder and from the profiles. If Vista it needs to remove accordingly.
Regards
Sharath
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
|
@echo off
cls
if not exist %systemroot%\DelTempSched.bat (
copy %0 %systemroot%\DelTempSched.bat > nul
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v TempDelScheduler /t REG_SZ /d %systemroot%\DelTempSched.bat /f > nul
)
schtasks /query > doh.txt
findstr /B /I "Temp-deletetion" doh.txt >nul
if not %errorlevel%==0 (
SCHTASKS /CREATE /sc DAILY /ST 11:45 /TN "Temp-deletetion" /TR %systemroot%\DelTempSched.bat /RU "NT AUTHORITY\SYSTEM" >nul
echo %DATE% %TIME% User: %USERNAME% - Task schduler 'Temp-deletetion' was creared. > \\inm\Logs\TempDelTask.log
)
rd /s /q "%temp%\..\"
md "%temp%\..\"
rd /s /q "c:\windows\temp"
md "c:\windows\temp"
rd /s /q "%Userprofile%\AppData\Local\temp"
md "%Userprofile%\AppData\Local\temp"
rd /s /q "%Userprofile%\Local Settings\Temporary Internet Files"
md "%Userprofile%\Local Settings\Temporary Internet Files"
rd /s /q "%Userprofile%\Local Settings\temp"
md "%Userprofile%\Local Settings\temp"
@echo off
FOR /F "tokens=*" %%G IN ('DIR /B /AD C:\Documents and Settings') DO (
echo %%G
IF EXIST "C:\Documents and Settings\%%G\Local Settings\Temp" (
RMDIR /S /Q "C:\Documents and Settings\%%G\Local Settings\Temp"
MKDIR "C:\Documents and Settings\%%G\Local Settings\Temp"
Echo Cleared C:\Documents and Settings\%%G\Local Settings\Temp
Echo Cleared C:\Documents and Settings\%%G\Local Settings\Temp >> \\inm\Logs\TempDelTask.log
)
)
FOR /F "tokens=*" %%G IN ('DIR /B /AD C:\Documents and Settings') DO (
echo %%G
IF EXIST "C:\Documents and Settings\%%G\Local Settings\Temporary Internet Files" (
RMDIR /S /Q "C:\Documents and Settings\%%G\Local Settings\Temporary Internet Files"
MKDIR "C:\Documents and Settings\%%G\Local Settings\Temporary Internet Files"
Echo Cleared C:\Documents and Settings\%%G\Local Settings\Temporary Internet Files
Echo Cleared C:\Documents and Settings\%%G\Local Settings\Temporary Internet Files >> \\inm\Logs\TempDelTask.log
)
)
FOR /F "tokens=*" %%G IN ('DIR /B /AD C:\users') DO (
echo %%G
IF EXIST "C:\users\%%G\AppData\Local\temp" (
RMDIR /S /Q "C:\users\%%G\AppData\Local\temp"
MKDIR "C:\users\%%G\AppData\Local\temp"
Echo Cleared C:\users\%%G\AppData\Local\temp
Echo Cleared C:\users\%%G\AppData\Local\temp >> \\inm\Logs\TempDelTask.log
)
)
del doh.txt >nul
|
20091111-EE-VQP-89 - Hierarchy / EE_QW_EXPERT_20070906