virelai Posted September 12, 2007 Posted September 12, 2007 (edited) Hello everybody,A question about my cleanup.cmd that seems not able to do its job.First i wrote these lines:taskkill /f /im explorer.exeRD /S/q "%UserProfile%\Local Settings\Temporary Internet Files"RD /S/q "%UserProfile%\Local Settings\History"RD /S/q "%UserProfile%\Recent"DEL /S/q "%UserProfile%\Local Settings\Temp\*.*"start explorer.exetaken from http://forums.techguy.org/windows-nt-2000-xp/424545-windows-xp-cache-cleanup.html://http://forums.techguy.org/windows-n...he-cleanup.html://http://forums.techguy.org/windows-n...he-cleanup.html://http://forums.techguy.org/windows-n...he-cleanup.html://http://forums.techguy.org/windows-n...he-cleanup.html://http://forums.techguy.org/windows-n...he-cleanup.html://http://forums.techguy.org/windows-n...he-cleanup.htmlbut it didn't work.I finally found out that it doesn't delete anything because it goes in the wrong profile, to be more precise, it goes in the Administrator profile.I mean, it goes to C:\Documents and Settings\Administrator\Local Settings and so on...why does it go this way even if i specify the correct path?Thank you Edited September 12, 2007 by virelai
Arie Posted September 13, 2007 Posted September 13, 2007 %UserProfile% refers to the profile of the logged in user. If you're logged in with the Administrator account, %UserProfile% will refer to this profile.
virelai Posted September 14, 2007 Author Posted September 14, 2007 It seems like the string that refers to the temp folder deletes the content of the correct temp folder (the one in my own profile), but it delets only files, not folders, even without the *.* is it something that has to do with the DEL command?Now, the other strings search for files to delete in the wrong folders, as i said in the Administrator folder, but I'm not logged in as administrator, i' logged in as "noname", I do have the Administrator rights, but I'not logged in with that profile. Also, i substituted %UserProfile% with "noname" but the same error occurs....Could you please post a syntax-correct cleanup.cmd for the folders I specified and that you know it works on your pc, that deletes not only files but also folders? I'm not pretending too much, am I? Thanks
Arie Posted September 14, 2007 Posted September 14, 2007 The correct syntax for the RD command is:RD /S /Q pathPlease note the spaces.I wouldn't delete a whole folder if I were you if it's not completely necessary. Deleting the contents of the Recent folder for example is enough, so why delete the folder? Wondering about this, why would you even want to delete the contents of your Recent folder? During an unattended setup nothing is opened, so nothing is added to it, so why even bothering to delete anything in it if there is nothing in it at all? Same goes for your Temporary Internet Files, there's nothing in it, so why even try to delete it's contents? Also, why kill the Explorer process? And what do you mean by "noname"? You're always logged in as something.
virelai Posted September 14, 2007 Author Posted September 14, 2007 (edited) I'm not talking of deleting the temp folder itself but being able to delete folders that are contained in it; with that code it only deletes files, not folders.This is not something i do for an unattended setup, it's meant to be just a little...let's say application that should let me delete all the files that are stored in these folders, just with one click, it's just to avoid going in every folder and delete the content. Killing the explorer process lets me delete files that may be in use by other programs.Thank you for your help. Edited September 14, 2007 by virelai
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now