windows temp file

Posted on 2011-03-16
Last Modified: 2012-06-21
i have found that multiple application user the c:\user\[username]\appdata\temp\ directory
so on my network, this temps folder vary between 2 gig and 22 gig of temp file

there is a way to control it, or to delete it when the session of a user start ?
Question by:GCI_SUPPORT
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4

Expert Comment

ID: 35147351
Creating the Batch File to Clean Temporary Files
1.Open Notepad and type the following:

cd C:\Users\%username%\AppData\Local
rmdir /S /Q Temp

2.Save the file as cleantemp.bat

3.Now double click on the file to remove your temporary files and free up space on your computer
If this doesn’t work and gives an access error, try replacing %username% with you windows login username.

Automating the Process of Deleting Temporary Files
To automate this process, so you do not need to remember to run it, do the following:

1.Right click on the batch file and select create shortcut
2.Place the shortcut in your startup folder in the start menu
Now when you log in to Windows 7, your temporary files will be deleted.


Author Comment

ID: 35147358
ill give a try

Author Comment

ID: 35147365
by the way there is a way to do it in a login script ?
SuperAntiSpyware Licenses Discounted by 25% !

Exclusive offer to Experts Exchange Members!
Buy SuperAntiSpyware License(s) from us and save 25% on the regular purchase price.
- Includes Full SuperAntiSpyware Vendor Support Entitlements
- Your Subscription does not begin until you activate your license
- Buy for your friends


Author Comment

ID: 35147501
reinstall windows, i don't think is a good idea. with a park of pc

Expert Comment

ID: 35147567
Create the script and place it on a commonly accessible network share. maybe you can set it to run with  group policy and select Computer Configuration --> Windows Settings --> Scripts --> Log-Off or Shutdown. Add a reference to the script

Expert Comment

ID: 35147625
also please try this out on a test machine first to make sure you get the desired results.

Accepted Solution

sweeps earned 500 total points
ID: 35147898
OK, if you save the bat file on a mapped drive, then add this code into your logon vbs

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "put your network path here" & Chr(34), 0
Set WshShell = Nothing

it will only delete files that are not in use but seems to get most out of the folder.

change the "put your network path here" with the relevant network path.  

you can test this by putting just this code into a vbs file on your computer and put the bat file out on the network and look at your temp folder so you get the idea of how much stuff is in it.  Then run the vbs file.  Then recheck your temp folder and see that most items are removed.

as always a test machine is a good idea for testing this.

Expert Comment

ID: 35149392
Thank you!

Author Comment

ID: 35149517
thanks sweep everything is working fine

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question