Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have been given the task of automating the deletion of files in a Win XP users Temporary Internet Files directory, as well as their cookies directory. Both of these directories can be found in Documents and Settings\username\Local Setttings.
I thought this would be a very simple task, I found the variables for current user and system drive, and write a batch file to delete all of the files in both directories. When I tried testing it nothing was getting deleted from Temporary Internet Files, and in fact from the NT command prompt you can't even see this directory unless you explicitly cd into it. It's a read only directory, and I tried to change that both through the GUI and with attrib from CL. Windows wouldn't let me do it. Next I tried deleting the files with a VBScript, and that failed to work with this directory as well. The only thing I can do that sort of works is invoke the Disk Cleanup wizard from the CL, but it won't remove the cookies in this directory, just the temp files.
Does anyone know how to get Windows to let you automate file deletion in this directory?? I am all out of ideas.

In Internet browser go to tools, Internet options, Advanced tab, scroll down to Security and tick Empty Temporary Internet Files folder when browser is closed. I don't no if this clears cookies as well. May be not
PhilC

Do this. Right click on your desktop and make a new "text" document.
THen copy and paste this command without the asterisks. "@echo on
cd %homedrive%%homepath%
rd /s/q locals~1\tempor~1
rd /s/q locals~1\temp\tempor~1
rd /s/q cookies
rd /s/q temp\cookies
rd /s/q locals~1\history
rd /s/q locals~1\temp\history
rd /s/q recent
md recent
rd /s/q locals~1\temp
md locals~1\temp "
call the file clean.cmd and save it in the directory C:\Documents and Settings\user\Start Menu\Programs\Startup. The user is yourself. Reboot

I am supposed to avoid the Tools Option, because... What I don't understand is why Windows has such a grip on this directory, I mean it's a temp dir, who cares.
Pucho I tried that, and it didn't work for me, however I will play with it a bit more and see if I can get it to work.
This is what has come the closest to working for me(in a bat file):
cleanmgr /sagerun:11
cd %HOMEDRIVE%\Documents and Settings\%USERNAME%\cookies
del * /q
exit

I hate to recommend software to solve problems, but it seems perfect for your needs. Check out "Pop up Stopper Professional" at www.panicware.com. It lets you clean up a variety of internet 'trails' such as history, cookies, temp files, and url history. Check it out.

Thanks for the info James, but I can't use that. I work for the state, and they are highly unlikely to buy anything for this.
This is why I am not a huge windows fan, things like this shouldn't be difficult to do...

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |