Creating a Batch file to Delete Temp Internet files (Full Version)

All Forums >> [Community] >> Computer Software and Hardware issues



Message


JustQuestions -> Creating a Batch file to Delete Temp Internet files (10/22/2004 14:35:29)

Does anyone know how to create a batch file that will delete temp internet files?

I have a lot of machines I need to do this on. I already have a way to delete the index.dat files, but I also need to empty the temp, history, and temporary internet files.

Can someone help, plz?

thanks,
CA




Giomanach -> RE: Creating a Batch file to Delete Temp Internet files (10/23/2004 17:52:43)

What OS are the machines on?

Either way:

Open Notepad>>enter the following:

quote:

cd\
cd C:\Documents and Settings\$username$\Local Settings\
del /Q Temporary Internet Files
echo Deleting Files
echo File Deleted
mkdir Temporary Internet Files
exit


Thats for Winows 2k, Xp and 2003, for NT, 9x, Me:

quote:

cd\
cd C:\Windows
del /Q Temporary Internet Files
echo Deleting Files
echo File Deleted
mkdir Temporary Internet Files
exit


Replace $username$ with the Account names used on the machine...

For deleting history and Temp, just change Temporary Internet Files for History or Temp.

And save the file as delete.bat or whatever you wish

Should work[8|]

I would try it on one machine before going any further though...I just wrote that off the top of my head




JustQuestions -> RE: Creating a Batch file to Delete Temp Internet files (10/25/2004 9:15:15)

Dan,

The OS is XP & 2000. After I saved the file as a bat it unfortunatly did not work. When I checked the folder the files were still there. So I tried just deleteing the files instead of deleteing the whole folder and recreating the folder. That didn't work either. The strange thing is that I can go into Temp Internet Files and delete files via explorer. So I don't understand why this isn't working. Here is what I used when deleting the files instead of the whole folder.

quote:

cd\
cd C:\Documents and Settings\kanderson\Local Settings\Temporary Internet Files\
del /Q *.*
echo Deleting Files
echo File Deleted
pause
exit


In either case I pretty impressed with quick response off the top of your head..... [:D] What else might you suggest?

Thanks for the help,
CA




Giomanach -> RE: Creating a Batch file to Delete Temp Internet files (10/25/2004 9:20:08)

quote:

del /Q *.*

DOS/Command Prompt ain't that clever...it looks for a file called *.* not deletes all files...

Try this:

quote:

cd\
cd C:\Documents and Settings\$username$\Local Settings\
del /Q /F Temporary Internet Files
echo Deleting Files
echo File Deleted
mkdir Temporary Internet Files
exit


Should delete them without any prompts and forces the deletion of Read Only Files...

It may just be that a batch file is incapable of this...Could always alter the registry on the machines to ensure IE is set to empty cache on exit?




dpf -> RE: Creating a Batch file to Delete Temp Internet files (10/25/2004 9:41:44)

quote:

Could always alter the registry on the machines to ensure IE is set to empty cache on exit?

no need to edit registry for that..IE has a setting under Tools/Internet Options/Advanced to delete temp files upon exit




Giomanach -> RE: Creating a Batch file to Delete Temp Internet files (10/25/2004 9:45:49)

True, but doing it that way means manual alteration of every single machine on the network - therefore impractical

If you edit the registry to do so, you can then export that registry key, and then use the logon script to install it on every machine every time a user logs on, or on the first time.

OK OK....I'll shut up now[8|]




JustQuestions -> RE: Creating a Batch file to Delete Temp Internet files (11/2/2004 10:25:27)

whats the string to edit it in the registry? One more thing, I just found out that they a few group policies on deleting temp intetnet files. So I want to thank you guys for help on this issue. First they ask me to come up with a way to delete these and then they tell me that they have a GP on coping these down from the local client machines. This can be one big cluster f***[:@], so again thank you for the assistance.

CA




Giomanach -> RE: Creating a Batch file to Delete Temp Internet files (11/2/2004 10:37:34)

The Key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Advanced Options\CRYPTO\CACHE_PAGES

My guess is to alter the Binary string DefaultValue from 0 to 1 - I've never altered the Page caching options for IE via the registry before[&:]




clum1 -> RE: Creating a Batch file to Delete Temp Internet files (11/3/2004 9:18:46)

If I remember correctly, the command prompt will require non DOS file and folder names to be within inverted commas:

quote:

"C:\Documents and Settings\$username$\Local Settings\"


this should work for NT-XP machines. 9x may require you to use the DOS name format,

eg. c:\mydocu~1

cheers

Calum




west158 -> RE: Creating a Batch file to Delete files that is on my computer (3/24/2007 12:38:52)

[:@] i am so struggling! could anyone tell me a line to delete a file on my computer?
here is what i would like it to say (example only)

del c:\document and settings\ MY NAME\desktop\FILE
in other words i want to delete a file on my computer and i would like to put the command line into a batch file, thankyou

[sm=ask.gif] [sm=bowdown.gif] [sm=BangHead.gif] [sm=help.gif] [sm=help.gif] [sm=help.gif]




clum1 -> RE: Creating a Batch file to Delete files that is on my computer (3/26/2007 2:40:05)

Hi West158; that command is correct but because you have spaces in the folder names, you must enclose the whole thing in double quotation marks:

del "c:\document and settings\ MY NAME\desktop\FILE.xxx"

Where .xxx is the three letter file extension (e.g. .doc. .xls, .txt etc)

Calum




Kenishi -> RE: Creating a Batch file to Delete files that is on my computer (8/1/2007 23:37:26)

try this
del /Q c:\WINDOWS\Temp
cd\\
cd C:\Documents and Settings\Kenishi\Local Settings\
rmdir /S/Q Temp
echo Deleting Files
echo File Deleted
mkdir Temp
exit


First part is the normal temp dir, the second one is the one in local setting.
The del command didnt work so i tried rmdir.
Now this script will not delete files in use, so youll always be stuck with a little clutter.
The temporary internet files i have not been able to delete yet. Thinking about changing the registry key so they get saved in one of the above directories. On first sight thats the easiest solution.

Hope this helps




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625