Delete Temp Files Batch File
Hi there guys/geniuses, Can someone help me with a batch file that cleans up all temp files (even in the c: windows temp), cookies, and all the $uninstall. I am trying to write an efficient batch file to do some cleanup for systems in our network prior to recreating new systems and copying some saved files. I work in an organisation which uses domain environment setup consisting of XP and 2000 Pro workstations. Occassionally i had to clean up temporary files.
I am trying to write an efficient batch file to do some cleanup for systems in our network prior to recreating new systems and copying some saved files over to the new computer. The following is what I am trying to clean up. Ok, I was able to figure this one out. Here is my own answer that works 99.5% There are a few small files that remain but I can live with them. The last two lines with the DEL command deletes the files from History and Temp unless another program still has the files in use. (Locked open) I ran this on a system with 30 users and approx 15 meg of junk files and deleted the unnecessary junk in less than two minutes. Hope This helps everyone.
We use Windows 2000 Pro in a domain with thousands of users and rebuild up to 100 computers each month. Here is a slightly expanded version of RDAdams's script, removes files from WINNT temp and [Profilename] Recent too. After reading your question I would ask you to see if the file exists in the directory on the target computer first.
You don't have to log onto the computer to check this. Use another computer and just open the c drive using start >run >targetcomputername c$ then browse to the directory in question and see what files are there. If it is then running the script would probably eliminate the error. A more direct way to eliminate just this one file would be to add the script to remove just that one file that is causing the problems. This would speed up the execution of your AD login script. Sorry for attaching myself after all the work you guys did.
Dicionario Ingles Michaelis Uol. Not sure if I should even post here but my question is similar to RDAdams. I am trying to delete cached profiles on multiple W2K systems that have hundreds of users within a few months. We have restrictive roaming profiles but there is still enough data being stored that the hard-drives are filling up too frequently.
The users are informed and save the majority of their data on server shares. I need a script or batch file that will allow me to delete profiles that are. Say over 2 weeks old. I realize GP would do this but it would take several months and many pulled teeth to accomplish. Any suggestions.
I am very novice when it comes to this. Let me know if i need to post a new topic in order to award points.
Hi there, I have been searching for this for ages. Servicing XP machines with multiple profiles is a real pain for us, but I was just wondering if you could explain to me what is actualy happening in one line in the batch file. I have a fairly good knowledge of Batch files and some knowledge of using variables. FOR /D%%X IN ('%SRC1% *') DO FOR /D%%Y IN ('%%X%SRC2% *.*') DO RMDIR /S /Q '%%Y' 1.
What is the 'FOR /D%%X IN ' doing exactly 2. Pudsey Bear Images there. Why is this there a Y and not an X like at the start here 'DO FOR /D%%Y IN' 3.
The /Q at the end I assume is not asking for confirmation If you can answer these that we be great thanks Mark. In regards to your questions: 1. What is the 'FOR /D%%X IN ' doing exactly - It conditionally performs a command on several folders versus the 'FOR' command which runs a specified command for each file in a set of files. Thre are two variables being used in the batchfile, hence%%x and%%y. The /Q switch is for Quiet mode. Using it means you will do not have to give a Yes/No Prompt before deleting. Here is my question, I created a simpler version of this, which I listed below.
It runs fine from the command line, but I f I try to execute it using the Task Scheduler, I receive the following error: Result: The task completed with an exit code of (3). I am using the local system account to operate the Task Scheduler Service and a Domain Admin account that has local Admin access to the particular test machine. Thanks in advance! Hi Guys, Can any one tell me where I can find a list of XP variable (like%SystemRoot% for c: windows?) Many thanks to Jonnydd and RDAdams for the batch file but the problem is that 1. The batch file is hard coded to set the variable one to be C: Documents and Settings.
Comments are closed.