What seems to work much better is relying on the underlying O/S commands to do it. Delete and Remove Directory are your friend. You can use the following batch file as a log off script for Active Directory or in the local policy on a stand alone machine.
@ECHO OFF
REM Empty user's temp directory of files and folders.
DEL /S /Q /F "%TEMP%\*.*"
FOR /D %%d IN ("%TEMP%\*.*") DO RD /S /Q "%%d"
REM Empty Window's temp directory
DEL /S /Q /F "C:\WINDOWS\Temp\*.*"
FOR /D %%d IN ("C:\WINDOWS\Temp\*.*") DO RD /S /Q "%%d"
REM If tmp and temp are different empty tmp as well
IF %temp% == %tmp% GOTO END
DEL /S /Q /F "%TMP%\*.*"
FOR /D %%d IN ("%TMP%\*.*") DO RD /S /Q "%%d"
:end
0 comments:
Post a Comment