Empty Temp folder on LogOff

  • Thread starter Thread starter Michael Tissington
  • Start date Start date
M

Michael Tissington

How can I automatically empty the contents of my Temporary folder when I
logoff ?

(I'm not talking about Tempory Internet Files)
 
Make a batch file with the following


cd %tmp%
del /q *.*
cd %windir%\temp
del /q *.*


And place the batch file or a shortcut in
%windir%\system32\GroupPolicy\Machine\Scripts\Shutdown

Or place a shortcut to the batch file in
%homepath%\Start Menu\Programs\Startup
to clean out the temp files on boot.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
How can I automatically empty the contents of my Temporary folder when I
logoff ?

(I'm not talking about Tempory Internet Files)

Shutdown/Shutdown script (XP Pro only):

Double-click "My Computer", double-click the C:\ drive.
Right-click a blank area, select "New Text Document". Double-click the "New Text Document.txt"
Copy & paste the below into the text file: (Change "C:\Temp" to the location of YOUR temp folder)

rd /s /q C:\Temp
md C:\Temp

Save the file, then rename it to deltmp.bat

NOTE "rd" removes the entire tree "C:\Temp" and ALL it's contents (including subdirectories)
NOTE "md" recreates the tree (empty)


Click Start, Run and enter GPEDIT.MSC
Go to Computer Configuration, Windows Settings, Scripts, Shutdown.
Browse to the location you saved the "deltmp.bat" file, and select it.
 
Shutdown/Shutdown script (XP Pro only):

Double-click "My Computer", double-click the C:\ drive.
Right-click a blank area, select "New Text Document". Double-click the "New Text Document.txt"
Copy & paste the below into the text file: (Change "C:\Temp" to the location of YOUR temp folder)

rd /s /q C:\Temp
md C:\Temp

Save the file, then rename it to deltmp.bat

NOTE "rd" removes the entire tree "C:\Temp" and ALL it's contents (including subdirectories)
NOTE "md" recreates the tree (empty)


Click Start, Run and enter GPEDIT.MSC
Go to Computer Configuration, Windows Settings, Scripts, Shutdown.
Browse to the location you saved the "deltmp.bat" file, and select it.


Beware that some software when first installed requires the temp files
on the first boot. Ask me how I know.
 
I know how you know. Same way that I know. ;-)

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top