The Windows Disk Cleanup Wizard will delete your temporary files, but only if they are over a week old. To create a simple batch script that will clean up your temporary directories, do the following (Vista instructions):
Creating the Batch File to Clean Temporary Files
- Open Notepad and type the following:
cd C:\Users\%username%\AppData\Local
rmdir /S /Q Temp - Save the file as cleantemp.bat
- 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:
- Right click on the batch file and select create shortcut
- 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.
About Rich
Rich is the owner and creator of Windows Guides; he spends his time breaking things on his PC so he can write how-to guides to fix them.
- Web
- |
- |
- |
- |
- Google+
- |
- More Posts (1020)
[…] Here is the original post: Automatically Delete Temporary Files in Windows 7 [How To #8230 […]
[…] Here is the original post: Automatically Delete Temporary Files in Windows 7 [How To #8230 […]
i did it many time, all what i got was a black flashed command-line windows that quickly went off without emptying my Temp folder
i did it many time, all what i got was a black flashed command-line windows that quickly went off without emptying my Temp folder
i did it many time, all what i got was a black flashed command-line windows that quickly went off without emptying my Temp folder
great article , I really like it
i did it many time, all what i got was a black flashed command-line windows that quickly went off without emptying my Temp folder
[…] Fuente […]
[…] Fuente […]
I don’t know that I’d be pressed for space enough to want to do this…
I don’t know that I’d be pressed for space enough to want to do this…
I don’t know that I’d be pressed for space enough to want to do this…
I don’t know that I’d be pressed for space enough to want to do this…
Nice tip, I hate temp directory…
Nice tip, I hate temp directory…
Nice tip, I hate temp directory…
Nice tip, I hate temp directory…
Nice and Simple Way to Do the Work
Nice and Simple Way to Do the Work
Nice and Simple Way to Do the Work
Nice and Simple Way to Do the Work
Hmmm, I’ve been using “cleanmgr /sagerun:99” for a while to do something similar by running the Windows Cleanup tool (A Good Thing: run “cleanmgr /sageset:99” to set options before running “cleanmgr /sagerun:99”). Works as well in the startup folder for “automagic” invocation at startup.
Hmmm, I’ve been using “cleanmgr /sagerun:99” for a while to do something similar by running the Windows Cleanup tool (A Good Thing: run “cleanmgr /sageset:99” to set options before running “cleanmgr /sagerun:99”). Works as well in the startup folder for “automagic” invocation at startup.
Hmmm, I’ve been using “cleanmgr /sagerun:99” for a while to do something similar by running the Windows Cleanup tool (A Good Thing: run “cleanmgr /sageset:99” to set options before running “cleanmgr /sagerun:99”). Works as well in the startup folder for “automagic” invocation at startup.
Hmmm, I’ve been using “cleanmgr /sagerun:99” for a while to do something similar by running the Windows Cleanup tool (A Good Thing: run “cleanmgr /sageset:99” to set options before running “cleanmgr /sagerun:99”). Works as well in the startup folder for “automagic” invocation at startup.
First off Rich, I really don’t like this new way of leaving a comment. The reason I registered here on this site is because I value my privacy and not sharing my info with others but only with those “I” chose. All I needed to do before was login and I could make a comment but now I had to do this through my Yahoo account and that just sucks. The only reason I’m continuing this conversation, is that I wish to make my point on this subject and I also had a question concerning this topic and was hoping to be entered for the Windows 7 Ultimate contest,lol. Anyways Mate, I’m very sorry for sounding very angry but enough of our personal info. is out there as it is and I only wished to deal with this site,you and our membership. This has been an excellent and very informative site for someone,as myself, whom may not be very “UP” when it comes to computers. If there is another way of posting,besides this way,the old way or a way that I don’t know about, I would like to continue using your excellent site Rich. If not, I’ll not be using this site anymore,very regretably, and wish to thank you and everyone else here for all their excellent work that has helped me along with my computer so far. If there is no other way of posting that’s only through this site,like the old way, then please delete me from any further e-mails please. Thank You. Yours sincerely GOLDENBOYWPG.
First off Rich, I really don’t like this new way of leaving a comment. The reason I registered here on this site is because I value my privacy and not sharing my info with others but only with those “I” chose. All I needed to do before was login and I could make a comment but now I had to do this through my Yahoo account and that just sucks. The only reason I’m continuing this conversation, is that I wish to make my point on this subject and I also had a question concerning this topic and was hoping to be entered for the Windows 7 Ultimate contest,lol. Anyways Mate, I’m very sorry for sounding very angry but enough of our personal info. is out there as it is and I only wished to deal with this site,you and our membership. This has been an excellent and very informative site for someone,as myself, whom may not be very “UP” when it comes to computers. If there is another way of posting,besides this way,the old way or a way that I don’t know about, I would like to continue using your excellent site Rich. If not, I’ll not be using this site anymore,very regretably, and wish to thank you and everyone else here for all their excellent work that has helped me along with my computer so far. If there is no other way of posting that’s only through this site,like the old way, then please delete me from any further e-mails please. Thank You. Yours sincerely GOLDENBOYWPG.
John,
If I understand correctly, you want to be able to comment without your Yahoo account? You can sign up for a JS-Kit.com account with the username GOLDENBOYWPG and you’ll be as anonymous as ever before.
Hope that helps :)
John,
If I understand correctly, you want to be able to comment without your Yahoo account? You can sign up for a JS-Kit.com account with the username GOLDENBOYWPG and you’ll be as anonymous as ever before.
Hope that helps :)
First off Rich, I really don’t like this new way of leaving a comment. The reason I registered here on this site is because I value my privacy and not sharing my info with others but only with those “I” chose. All I needed to do before was login and I could make a comment but now I had to do this through my Yahoo account and that just sucks. The only reason I’m continuing this conversation, is that I wish to make my point on this subject and I also had a question concerning this topic and was hoping to be entered for the Windows 7 Ultimate contest,lol. Anyways Mate, I’m very sorry for sounding very angry but enough of our personal info. is out there as it is and I only wished to deal with this site,you and our membership. This has been an excellent and very informative site for someone,as myself, whom may not be very “UP” when it comes to computers. If there is another way of posting,besides this way,the old way or a way that I don’t know about, I would like to continue using your excellent site Rich. If not, I’ll not be using this site anymore,very regretably, and wish to thank you and everyone else here for all their excellent work that has helped me along with my computer so far. If there is no other way of posting that’s only through this site,like the old way, then please delete me from any further e-mails please. Thank You. Yours sincerely GOLDENBOYWPG.
First off Rich, I really don’t like this new way of leaving a comment. The reason I registered here on this site is because I value my privacy and not sharing my info with others but only with those “I” chose. All I needed to do before was login and I could make a comment but now I had to do this through my Yahoo account and that just sucks. The only reason I’m continuing this conversation, is that I wish to make my point on this subject and I also had a question concerning this topic and was hoping to be entered for the Windows 7 Ultimate contest,lol. Anyways Mate, I’m very sorry for sounding very angry but enough of our personal info. is out there as it is and I only wished to deal with this site,you and our membership. This has been an excellent and very informative site for someone,as myself, whom may not be very “UP” when it comes to computers. If there is another way of posting,besides this way,the old way or a way that I don’t know about, I would like to continue using your excellent site Rich. If not, I’ll not be using this site anymore,very regretably, and wish to thank you and everyone else here for all their excellent work that has helped me along with my computer so far. If there is no other way of posting that’s only through this site,like the old way, then please delete me from any further e-mails please. Thank You. Yours sincerely GOLDENBOYWPG.
John,
If I understand correctly, you want to be able to comment without your Yahoo account? You can sign up for a JS-Kit.com account with the username GOLDENBOYWPG and you’ll be as anonymous as ever before.
Hope that helps :)
John,
If I understand correctly, you want to be able to comment without your Yahoo account? You can sign up for a JS-Kit.com account with the username GOLDENBOYWPG and you’ll be as anonymous as ever before.
Hope that helps :)
How can I tell if it actually did anything? My free disk space didn't change.
In Explorer, navigate to C:Users%username%AppDataLocal
If there is a Temp folder in this location, the clean has been unsuccessful.
I have a shortcut to clear the RAM; here;s the target of the shortcut: “%windir%system32rundll32.exe advapi32.dll,ProcessIdleTasks”. I was wondering if there is a way to add this to the .bat?
You can add that in but I don't recommend using this command. If your system needs memory, it will automatically do this anyway.
Thanks for the response. If I were to add this in, do I just paste the target in on the line after rmdir /S /Q Temp?
You got it :)
The file should like this:
cd C:Users%username%AppDataLocal
rmdir /S /Q Temp
%windir%system32rundll32.exe advapi32.dll,ProcessIdleTasks
My temp directory is f*****g 25gigs..
Hm..this method removes the Temp folder, and some programs need it to work. Folder Lock for instance. Could someone make a batch file that empties %UserProfile%AppDataLocalTemp and %SystemRoot%Temp but doesn´t remove the folders..? On vista and xp this “add clear system temps” thing http://www.vistax64.com/tutorials/74471-recycle-bin-add-program-menu.html works like a charm, but a batch file for windows 7 would rock. Thanks.
A simple batch file for Windows 7 to clear the temp folder contents at
%UserProfile%AppDataLocalTemp would be:
cd %tmp%
rd /s/Q .
(that’s cd space %tmp% and then on second line rd space /s/Q space dot.
The same method can be used for the system temp folder at %SystemRoot%Temp
To automate simply place the batch file in your startup folder at:
C > Users > Name > AppData > Roaming > Microsoft > Windows > Start Menu > Programs > Startup
This will delete the contents of the temp folder at every boot but leave the actual directories (Temp Folders) intact.
good simple clean
One problem though.
This clears the temp even when you reboot after a crash. That way temp files created by programs like AutoCAD would be cleared and hence the ‘last chance’ to recover the drawing would be lost. Could you add one more line to take the user input Y/N with a question “About to Clear Temp Folder. Proceed? … “
On the start menu search bar just type in `%temp%` (without quotations) and the temporary folder should open. Hit `Ctrl A`and delete.. :-)
1-navigate to C:UsersAdministratorAppDataLocalTemp DEL ALL
2-C:WindowsTemp DEL ALL
3-C:WindowsPrefetch DEL ALL
cool! works reat on WIN7 – ty a lot :)
remove temporay windows7 sites
Sure all you have to do is this
cd %temp%
del *.* /F /Q
RD /S /Q %temp%
cd C:WindowsTemp
del *.* /F /Q
RD /S /Q %temp%
This will remove all non used directories and remove all temp files out of the temp and windows temp folders. Any other folder you want to clean out you just replace the first line with the directory you want cleared.