[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.

11/04/2009 at 02:39AM PST, ID: 24870395 | Points: 500
[x]
Attachment Details

Temp files deletetion script does not clear all profiles and all temp folders.

Asked by bsharath in Programming Languages, Scripting Languages, Windows Batch Scripting

Tags: Script, Bat, vbs

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
[+][-]11/04/09 05:03 AM, ID: 25738835

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 06:29 AM, ID: 25739577

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 06:48 AM, ID: 25739802

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 06:51 AM, ID: 25739832

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 07:53 AM, ID: 25740556

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 07:55 AM, ID: 25740575

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 07:56 AM, ID: 25740596

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 07:58 AM, ID: 25740622

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 07:58 AM, ID: 25740625

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 08:00 AM, ID: 25740639

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 08:00 AM, ID: 25740645

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 08:01 AM, ID: 25740657

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 08:18 AM, ID: 25740862

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 08:28 AM, ID: 25740984

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 08:28 AM, ID: 25740988

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 11:07 AM, ID: 25742693

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 06:32 PM, ID: 25773068

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 05:37 AM, ID: 25775753

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/09 08:34 AM, ID: 25777425

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 05:58 AM, ID: 25804468

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 06:03 AM, ID: 25804507

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/12/09 07:37 AM, ID: 25805428

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 07:53 AM, ID: 25805599

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 08:00 AM, ID: 25805669

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/12/09 08:04 AM, ID: 25805715

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 08:05 AM, ID: 25805731

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 08:10 AM, ID: 25805792

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 08:19 AM, ID: 25805880

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/12/09 06:21 PM, ID: 25810938

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 04:42 AM, ID: 25824507

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 04:47 AM, ID: 25824521

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 05:03 AM, ID: 25824547

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 05:15 AM, ID: 25824587

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/15/09 05:37 AM, ID: 25824654

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/15/09 09:29 AM, ID: 25825547

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/16/09 12:38 PM, ID: 25833845

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/16/09 06:44 PM, ID: 25836428

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/09 08:56 AM, ID: 25851769

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/09 09:03 AM, ID: 25851848

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/18/09 09:07 AM, ID: 25851898

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/09 09:10 AM, ID: 25851918

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/18/09 09:12 AM, ID: 25851934

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/18/09 09:13 AM, ID: 25851946

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/18/09 09:38 AM, ID: 25852496

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/23/09 07:16 PM, ID: 25893766

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_EXPERT_20070906