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....
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
-----
User Specific files:
C:\Documents and Settings\user\Local Settings\History
C:\Documents and Settings\user\Local Settings\Temp
C:\Documents and Settings\user\Local Settings\Temporary Internet Files\Content.IE5
General System files:
C:\WINNT\Temp
C:\WINNT\system32\spool\PR
INTERS
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
------
I am having problems deleting the files from these two directories
C:\Documents and Settings\radams\Local Settings\History
C:\Documents and Settings\radams\Local Settings\Temp
I am looking to delete all files in these two folders for every person/profile on the system. Some systems may have 5 or more profiles on them.
The following code works for everything else except these two folders. What am I missing?
Any assistance would be appreciated.
--------------------------
----------
----------
----------
----------
----
SET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files\Content.IE5
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
del "C:\winnt\system32\spool\P
RINTERS\*.
*" /f /s /q
del "C:\winnt\temp\*.*" /f /s /q
exit
Start Free Trial