0

I am not new to the business but I am definitely not advanced in any way, also I am new to daniweb and am not sure if this is the correct forum. I am trying to create a batch file in XP that clears the IE cache, temp internet fils, and History upon execution. Thank you for all your help.

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by amrahne
0

don't know batch files but im sure there is a way ,but i use CCleaner just run it and you scan computer and remove what you want plus a lot more junk and temp files .
http://www.ccleaner.com/

Thank you very much for this reply however I should have been a bit more specific.

I administer a 80-100 person network for a large corporation. I cannot use free personal software. What I am requesting is just the code for a simple execution of clearing 3 folders of there contents.

0

Thank you very much for this reply however I should have been a bit more specific.

I administer a 80-100 person network for a large corporation. I cannot use free personal software. What I am requesting is just the code for a simple execution of clearing 3 folders of there contents.

OOOOOOOOOOOOOH ,that's different ,don't know but im sure someone here does .maybe you could look in the section of the forum for coders.think they would teach batch coding in IT admin school .any link to programing section below ,pick one .hope this helps good luck
http://www.daniweb.com/forums/

edit: I think bach files only use dos commands and not sure if there is a dos commad for emptying folders .
edit#2 actualyl just found this dos command site .and it states =del c:\windows\temp\*.* = (* is for wild character(s)) *.* indicates that you would like to delete all files in the c:\windows\temp directory. so it should be possiable i guess .
site will all dos commands .
http://www.computerhope.com/msdos.htm

over my head but maybe not yours .again good luck .
http://www.tnd.com/camosun/elex130/dosbatchtutor1.html

0

I have used this code successfully for quite a while.

@ECHO OFF 
Echo.
Echo ClearCache 1.1 (2004) for Windows 2000 and XP
Echo Removes temporary files FROM ALL PROFILES.
Echo.
Echo Authors: by Cher Aza, Jimbob60, and Mirfster.
Echo.
Echo Temporary files will be removed from the following locations:
Echo.
Echo   1. [Profile]\Local Settings\Temporary Internet Files
Echo   2. [Profile]\Local Settings\History
Echo   3. [Profile]\Local Settings\Temp
Echo   4. [Profile]\Cookies
Echo   5. [Profile]\Recent
Echo   6. [SystemRoot]\Temp
Echo.
Echo This batch file will close automatically when finished.
Echo.
Echo Press Ctrl+C to abort or any other key to continue . . .
Echo.
PAUSE > NUL
:: Clear local Temporary Internet Files and History
Echo.
Echo The following errors are normal:
RD /S /Q "%Userprofile%\Local Settings\Temporary Internet Files"
RD /S /Q "%Userprofile%\Local Settings\History"
:: Clear all other temporary cache files in all profiles
SET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp
SET SRC5=Cookies
SET SRC6=Recent
Echo.
Echo About to delete files from Internet Explorer "Temporary Internet files"
Echo This may take a few minutes.  Please wait...
Echo The following error is normal:
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
Echo.
Echo About to delete files from Internet Explorer "History"
Echo This may take a few minutes.  Please wait...
Echo The following error is normal:
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 "Local settings\temp"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC4%\*.*") DO RMDIR  /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 "Cookies"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC5%\*.*") DO DEL /F /S /Q "%%Y"
Echo About to delete files from "Recent" i.e. what appears in Start/Documents/My Documents
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC6%\*.lnk") DO DEL /F /S /Q "%%Y"
Echo About to delete files from "[SystemRoot]\Temp"
CD /D %SystemRoot%\Temp
DEL /F /Q *.*
RD /S /Q "%SystemRoot%\Temp"
CD /D %SystemRoot%
MD Temp
:: Done!
Echo Done!
EXIT
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.