deleting temp file's in DOS

Associate
Joined
8 Mar 2007
Posts
2,176
Location
between here and there
hey all,

I'm writing a simple bacth file to remove those blasted temp file's from pc every monday night.

since i only have one account that is used on this machine i can use ask it to del the files from my "C:\Documents and Settings\Tristan\Local Settings\Temp" folder.

The problem is that if i do this i still get left with a load of read only files. when i try with just del /q "C:\Documents and Settings\Tristan\Local Settings\Temp\*.*" i get acess deinded error.

I have tried using the /f switch to force delete the read only stuff but it then doesn't even give me the 'access denided' error

is there anything more powerfull than 'del' in dos??

I can remove these files by selecting them and sending to the bin, but i wanted to automate it.

cheers for your help guys;)


edit;

I've also tried deleing the temp folder alltogether and them making an new empty one in its place, but no luck. :(
 
thanks for the reply..

plonk a shortcut on your desktop or maybe even in the startup folder. no need to worry about permssions then.

This is an option, but tbh i'd rather not have another shortcut on my desktop.

I also entend to put this (or at least a version of this) on serval family members PC so they don't have to worry about it, (and so they don't call me and say, 'my Pc running slowly')

So really it does need to be automatic.

any ideas
 
use scheduled tasks then.

I thought that'll be easier but.....


I set the permissions for the task, but it still wont delete the temp files from within the temp folder.

I then get a taskobject (.job) in my recycle bin.

can anyone talk me though this???

or shall i post in windows and other software?

cheers
 
sorry, i didn't explain very well.

I have only 2 user on this laptop. admin and tris. I only ever use admin.

The bacth file is very simple

Code:
@echo off

cd\
cd "C:\Documents and Settings\Administrator\Local Settings\Temp"
del /f /q *.*
pause

exit

I have tested it (by changing the folder paths and running) and it works fine.

I also set the scheduled task to run at log on so it should have the right permissions. I did use the 'runas' setting and put in computername\administrator and set the password, but i still get the same result.

:confused:
 
cheers guys.

ccleaner will do the job real nice like...

but i've answered my own question.

I had to use RMDIR (the XP prompt replacment for DELTREE) to remove everything in it.

I also had to unhide the local settings folder for my user.

All good. cheers.

:)
 
Back
Top Bottom